Author: Ronan Lamy <[email protected]>
Branch: testing-cleanup
Changeset: r85008:ae78acb71286
Date: 2016-06-07 20:18 +0100
http://bitbucket.org/pypy/pypy/changeset/ae78acb71286/
Log: Use pytest_collection_modifyitems to apply the interplevel marker
diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -76,6 +76,17 @@
def pytest_pycollect_makemodule(path, parent):
return PyPyModule(path, parent)
+def is_applevel(item):
+ from pypy.tool.pytest.apptest import AppTestFunction
+ return isinstance(item, AppTestFunction)
+
+def pytest_collection_modifyitems(config, items):
+ if config.option.runappdirect:
+ return
+ for item in items:
+ if isinstance(item, py.test.Function) and not is_applevel(item):
+ item.add_marker('interplevel')
+
class PyPyModule(py.test.collect.Module):
""" we take care of collecting classes both at app level
and at interp-level (because we need to stick a space
diff --git a/pypy/tool/pytest/inttest.py b/pypy/tool/pytest/inttest.py
--- a/pypy/tool/pytest/inttest.py
+++ b/pypy/tool/pytest/inttest.py
@@ -6,13 +6,8 @@
from pypy.conftest import PyPyClassCollector
-marker = py.test.mark.interplevel
-
-
class IntTestFunction(py.test.collect.Function):
- def __init__(self, *args, **kwargs):
- super(IntTestFunction, self).__init__(*args, **kwargs)
- self._request.applymarker(marker)
+ pass
class IntInstanceCollector(py.test.collect.Instance):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit