Commits

Ronny Pfannschmidt  committed 152b03a

introduce pytest bugfixes plugin as place to keep our changes

  • Participants
  • Parent commits fc0bb86
  • Branches pytest

Comments (0)

Files changed (4)

File pypy/conftest.py

 #
 
 pytest_plugins = [
+    'rpython.tool.pytest.bugfixes',
     'rpython.tool.pytest.leakfinder',
+    'rpython.tool.pytest.platform',
     'rpython.tool.pytest.viewerplugin',
-    'rpython.tool.pytest.platform',
 ]
 
 pypydir = os.path.realpath(os.path.dirname(__file__))
 
 
 def pytest_addoption(parser):
-    
     group = parser.getgroup("pypy options")
     group.addoption('-A', '--runappdirect', action="store_true",
            default=False, dest="runappdirect",

File rpython/conftest.py

 import py
 
 pytest_plugins = [
+    'rpython.tool.pytest.bugfixes',
     'rpython.tool.pytest.expecttest',
     'rpython.tool.pytest.leakfinder',
     'rpython.tool.pytest.platform',
 cdir = realpath(join(dirname(__file__), 'translator', 'c'))
 cache_dir = realpath(join(dirname(__file__), '_cache'))
 
-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
 
-

File rpython/tool/pytest/bugfixes.py

+import py
+
+
+def braindead_deindent(self):
+    """monkeypatch that wont end up doing stupid in the python tokenizer"""
+    text = '\n'.join(self.lines)
+    short = py.std.textwrap.dedent(text)
+    newsource = py.code.Source()
+    newsource.lines[:] = short.splitlines()
+    return newsource
+
+
+def pytest_configure():
+    py.code.Source.deindent = braindead_deindent
+
+
+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

File rpython/tool/pytest/platform.py

 import py
 import pytest
 
-def braindead_deindent(self):
-    """monkeypatch that wont end up doing stupid in the python tokenizer"""
-    text = '\n'.join(self.lines)
-    short = py.std.textwrap.dedent(text)
-    newsource = py.code.Source()
-    newsource.lines[:] = short.splitlines()
-    return newsource
-
-py.code.Source.deindent = braindead_deindent
 
 def pytest_report_header():
     return "pytest-%s from %s" %(pytest.__version__, pytest.__file__)