[pypy-commit] pypy split-rpython: work around pytest issue 251

RonnyPfannschmidt noreply at buildbot.pypy.org
Fri Jan 18 10:00:12 CET 2013


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: split-rpython
Changeset: r60166:812974e07064
Date: 2013-01-18 09:59 +0100
http://bitbucket.org/pypy/pypy/changeset/812974e07064/

Log:	work around pytest issue 251

	collection ignores test classes with __init__ for unittest support,
	but is silent about that

diff --git a/rpython/conftest.py b/rpython/conftest.py
--- a/rpython/conftest.py
+++ b/rpython/conftest.py
@@ -2,13 +2,6 @@
 import py, pytest
 from rpython.tool import leakfinder
 
-# XXX
-# <ronny> Aquana, i just ensured that with the pypy conftest we get all skips,
-# i'll investigate differences in collection tommorow, for now, can you just
-# import the makemodule hook from pypy and add a comment that im responsible
-# for fixing?
-from pypy.conftest import pytest_pycollect_makemodule
-
 cdir = realpath(join(dirname(__file__), 'translator', 'c'))
 cache_dir = realpath(join(dirname(__file__), '_cache'))
 option = None
@@ -38,15 +31,6 @@
     set_platform(value, None)
 
 def pytest_addoption(parser):
-    # XXX
-    # <ronny> Aquana, i just ensured that with the pypy conftest we get all skips,
-    # i'll investigate differences in collection tommorow, for now, can you just
-    # import the makemodule hook from pypy and add a comment that im responsible
-    # for fixing?
-    from pypy.conftest import pytest_addoption
-    pytest_addoption(parser)
-    
-    
     group = parser.getgroup("rpython options")
     group.addoption('--view', action="store_true", dest="view", default=False,
            help="view translation tests' flow graphs with Pygame")
@@ -58,6 +42,17 @@
            default=False, dest="viewloops",
            help="show only the compiled loops")
 
+
+def pytest_pycollect_makeitem(__multicall__,collector, name, obj):
+    res = __multicall__.execute()
+    # work around pytest issue 251
+    import inspect
+    if res is None and inspect.isclass(obj) and \
+            collector.classnamefilter(name):
+        return py.test.collect.Class(name, parent=collector)
+    return res
+
+
 def pytest_addhooks(pluginmanager):
     pluginmanager.register(LeakFinder())
 


More information about the pypy-commit mailing list