[pypy-svn] pypy pytest2: make conftest.option available after the test session is configured

hpk42 commits-noreply at bitbucket.org
Tue Jan 18 14:44:24 CET 2011


Author: holger krekel <holger at merlinux.eu>
Branch: pytest2
Changeset: r40856:eb9a6ccd8035
Date: 2011-01-18 12:55 +0100
http://bitbucket.org/pypy/pypy/changeset/eb9a6ccd8035/

Log:	make conftest.option available after the test session is configured
	(it's not neccessarily available at conftest.py import time)

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -43,6 +43,10 @@
            default="host", callback=_set_platform,
            help="set up tests to use specified platform as compile/run target")
 
+def pytest_configure(config):
+    global option
+    option = config.option
+
 def pytest_sessionstart():
     # have python subprocesses avoid startup customizations by default
     try:

diff --git a/pypy/tool/pytest/appsupport.py b/pypy/tool/pytest/appsupport.py
--- a/pypy/tool/pytest/appsupport.py
+++ b/pypy/tool/pytest/appsupport.py
@@ -163,7 +163,7 @@
             except py.error.ENOENT: 
                 source = None
             from pypy import conftest
-            if source and not conftest.option.nomagic: 
+            if source and not py.test.config.option.nomagic:
                 msg = py.code._reinterpret_old(source, runner, should_fail=True)
                 space.setattr(w_self, space.wrap('args'),
                             space.newtuple([space.wrap(msg)]))


More information about the Pypy-commit mailing list