3 new commits in pytest:

https://bitbucket.org/hpk42/pytest/commits/afe429ed8605/
Changeset:   afe429ed8605
User:        hpk42
Date:        2013-12-09 10:38:40
Summary:     fix changelog
Affected #:  1 file

diff -r 0017064cd59995049af1ea0b8ae166527cea9720 -r 
afe429ed860586910bbb1d166ac6a71bdf9418e5 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -26,9 +26,10 @@
   with repeated same values (sometimes useful to to test if calling 
   a second time works as with the first time).
 
-- fix issue246 (again) fix finalizer order to be LIFO on independent fixtures
+- fix issue246 fix finalizer order to be LIFO on independent fixtures
   depending on a parametrized higher-than-function scoped fixture. 
-  (fix quite some effort so please bear with the complexity of this sentence :)
+  (was quite some effort so please bear with the complexity of this sentence :)
+  Thanks Ralph Schmitt for the precise failure example.
  
 - fix issue244 by implementing special index for parameters to only use
   indices for paramentrized test ids
@@ -54,10 +55,6 @@
   since the unittest compat enhancements allow
   trial to handle it on its own
 
-- fix ordering of finalizers of parametrized interdependent fixtures.
-  This fixes issue246 as reported.  Thanks Ralph Schmitt for the 
-  precise failure example.
-
 - don't hide an ImportError when importing a plugin produces one.
   fixes issue375.
 


https://bitbucket.org/hpk42/pytest/commits/2b93666c0e22/
Changeset:   2b93666c0e22
User:        hpk42
Date:        2013-12-09 10:40:39
Summary:     some minor internal cleanup
Affected #:  2 files

diff -r afe429ed860586910bbb1d166ac6a71bdf9418e5 -r 
2b93666c0e22329a93acb4afd5b324f6e3136a86 _pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -16,8 +16,7 @@
                   initialization.
     """
     config = _prepareconfig(args, plugins)
-    exitstatus = config.hook.pytest_cmdline_main(config=config)
-    return exitstatus
+    return config.hook.pytest_cmdline_main(config=config)
 
 class cmdline:  # compatibility namespace
     main = staticmethod(main)

diff -r afe429ed860586910bbb1d166ac6a71bdf9418e5 -r 
2b93666c0e22329a93acb4afd5b324f6e3136a86 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1661,15 +1661,15 @@
                                     yieldctx=marker.yieldctx,
                                     unittest=unittest)
             faclist = self._arg2fixturedefs.setdefault(name, [])
-            if not fixturedef.has_location:
-                # All fixturedefs with no location are at the front
+            if fixturedef.has_location:
+                faclist.append(fixturedef)
+            else:
+                # fixturedefs with no location are at the front
                 # so this inserts the current fixturedef after the
                 # existing fixturedefs from external plugins but
                 # before the fixturedefs provided in conftests.
                 i = len([f for f in faclist if not f.has_location])
-            else:
-                i = len(faclist)  # append
-            faclist.insert(i, fixturedef)
+                faclist.insert(i, fixturedef)
             if marker.autouse:
                 autousenames.append(name)
         if autousenames:


https://bitbucket.org/hpk42/pytest/commits/e2bfc7bfd1a2/
Changeset:   e2bfc7bfd1a2
User:        hpk42
Date:        2013-12-09 10:48:15
Summary:     address issue122 -- explode "params" into a list in fixture 
function decorators
Affected #:  3 files

diff -r 2b93666c0e22329a93acb4afd5b324f6e3136a86 -r 
e2bfc7bfd1a2e5509d064a26383fb5b0fbfe643c CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -64,6 +64,9 @@
 - fix issue380 by making --resultlog only rely on longrepr instead
   of the "reprcrash" attribute which only exists sometimes.
 
+- address issue122: allow @pytest.fixture(params=iterator) by exploding
+  into a list early on.
+
 - fix pexpect-3.0 compatibility for pytest's own tests.
   (fixes issue386)
 

diff -r 2b93666c0e22329a93acb4afd5b324f6e3136a86 -r 
e2bfc7bfd1a2e5509d064a26383fb5b0fbfe643c _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -76,8 +76,9 @@
         # direct decoration
         return FixtureFunctionMarker(
                 "function", params, autouse)(scope)
-    else:
-        return FixtureFunctionMarker(scope, params, autouse)
+    if params is not None and not isinstance(params, (list, tuple)):
+        params = list(params)
+    return FixtureFunctionMarker(scope, params, autouse)
 
 def yield_fixture(scope="function", params=None, autouse=False):
     """ (return a) decorator to mark a yield-fixture factory function

diff -r 2b93666c0e22329a93acb4afd5b324f6e3136a86 -r 
e2bfc7bfd1a2e5509d064a26383fb5b0fbfe643c testing/python/fixture.py
--- a/testing/python/fixture.py
+++ b/testing/python/fixture.py
@@ -914,6 +914,34 @@
         reprec = testdir.inline_run()
         reprec.assertoutcome(passed=1)
 
+    def test_fixture_parametrized_with_iterator(self, testdir):
+        testdir.makepyfile("""
+            import pytest
+
+            l = []
+            def f():
+                yield 1
+                yield 2
+            dec = pytest.fixture(scope="module", params=f())
+
+            @dec
+            def arg(request):
+                return request.param
+            @dec
+            def arg2(request):
+                return request.param
+
+            def test_1(arg):
+                l.append(arg)
+            def test_2(arg2):
+                l.append(arg2*10)
+        """)
+        reprec = testdir.inline_run("-v")
+        reprec.assertoutcome(passed=4)
+        l = reprec.getcalls("pytest_runtest_call")[0].item.module.l
+        assert l == [1,2, 10,20]
+
+
 class TestFixtureManagerParseFactories:
     def pytest_funcarg__testdir(self, request):
         testdir = request.getfuncargvalue("testdir")

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.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to