[Pytest-commit] commit/pytest: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Dec 16 09:23:07 CET 2013


2 new commits in pytest:

https://bitbucket.org/hpk42/pytest/commits/5863c38ae3cf/
Changeset:   5863c38ae3cf
User:        hpk42
Date:        2013-12-16 07:47:59
Summary:     fix issue403 : allow same-name parametrized functions within a collector
Affected #:  2 files

diff -r 23e0cbf30ff9e1faf69b67c12a6354d8b7106d60 -r 5863c38ae3cf47daa12da4c43a86658403eef89c _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1529,7 +1529,8 @@
         self._nodename2fixtureinfo = {}
 
     def getfixtureinfo(self, node, func, cls, funcargs=True):
-        key = (node, func.__name__)
+        # node is the "collection node" for "func"
+        key = (node, func)
         try:
             return self._nodename2fixtureinfo[key]
         except KeyError:

diff -r 23e0cbf30ff9e1faf69b67c12a6354d8b7106d60 -r 5863c38ae3cf47daa12da4c43a86658403eef89c testing/python/metafunc.py
--- a/testing/python/metafunc.py
+++ b/testing/python/metafunc.py
@@ -630,6 +630,22 @@
             "*3 passed*"
         ])
 
+    def test_generate_same_function_names_issue403(self, testdir):
+        sub1 = testdir.makepyfile("""
+            import pytest
+
+            def make_tests():
+                @pytest.mark.parametrize("x", range(2))
+                def test_foo(x):
+                    pass
+                return test_foo
+
+            test_x = make_tests()
+            test_y = make_tests()
+        """)
+        reprec = testdir.inline_run()
+        reprec.assertoutcome(passed=4)
+
 
 class TestMarkersWithParametrization:
     pytestmark = pytest.mark.issue308


https://bitbucket.org/hpk42/pytest/commits/de9c3a3932c3/
Changeset:   de9c3a3932c3
User:        hpk42
Date:        2013-12-16 08:04:46
Summary:     amend CHANGELOG with credits and issue mentioning
Affected #:  1 file

diff -r 5863c38ae3cf47daa12da4c43a86658403eef89c -r de9c3a3932c3c1c921360028c88465d36c4968e5 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,10 +1,16 @@
 Unreleased
 -----------------------------------
 
+- fix issue403: allow parametrize of multiple same-name functions within
+  a collection node.  Thanks Andreas Kloeckner and Alex Gaynor for reporting
+  and analysis.
+
 - Allow parameterized fixtures to specify the ID of the parameters by
   adding an ids argument to pytest.fixture() and pytest.yield_fixture().
+  Thanks Floris Bruynooghe. 
 
-- fix issue404 by always using the binary xml escape in the junitxml plugin
+- fix issue404 by always using the binary xml escape in the junitxml
+  plugin.  Thanks Ronny Pfannschmidt.
 
 2.5.0
 -----------------------------------

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list