[Pytest-commit] commit/pytest: hpk42: pytestconfig is now session-config as it is the same object during the

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Oct 21 13:33:45 CEST 2013


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/b1b760614b0e/
Changeset:   b1b760614b0e
User:        hpk42
Date:        2013-10-21 13:33:36
Summary:     pytestconfig is now session-config as it is the same object during the
whole test run.  Fixes issue370
Affected #:  3 files

diff -r 728a45eb659ebfcdec4042be31aec9ebd6d80bc8 -r b1b760614b0ea95cce3b07aeb7e5e6b012e430d2 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,9 @@
   properly so that the pkg_resources.resource_stream method works properly.
   Fixes issue366.  Thanks for the investigations and full PR to Jason R. Coombs.
 
+- pytestconfig is now session-config as it is the same object during the
+  whole test run.  Fixes issue370. 
+
 - avoid one surprising case of marker malfunction/confusion::
   
       @pytest.mark.some(lambda arg: ...)

diff -r 728a45eb659ebfcdec4042be31aec9ebd6d80bc8 -r b1b760614b0ea95cce3b07aeb7e5e6b012e430d2 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -157,7 +157,7 @@
         '_fillfuncargs': fillfixtures}
     }
 
- at fixture()
+ at fixture(scope="session")
 def pytestconfig(request):
     """ the pytest config object with access to command line opts."""
     return request.config
@@ -1566,8 +1566,8 @@
                 continue # will raise FixtureLookupError at setup time
             for fixturedef in faclist:
                 if fixturedef.params is not None:
-                    metafunc.parametrize(argname, fixturedef.params, indirect=True,
-                                         scope=fixturedef.scope)
+                    metafunc.parametrize(argname, fixturedef.params,
+                                         indirect=True, scope=fixturedef.scope)
 
     def pytest_collection_modifyitems(self, items):
         # separate parametrized setups

diff -r 728a45eb659ebfcdec4042be31aec9ebd6d80bc8 -r b1b760614b0ea95cce3b07aeb7e5e6b012e430d2 testing/python/integration.py
--- a/testing/python/integration.py
+++ b/testing/python/integration.py
@@ -150,3 +150,7 @@
         result.stdout.fnmatch_lines("""
             *2 passed*
         """)
+
+def test_pytestconfig_is_session_scoped():
+    from _pytest.python import pytestconfig
+    assert pytestconfig._pytestfixturefunction.scope == "session"

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