[pypy-commit] pypy pytest-25: Fix creation and use of 'interplevel' and 'applevel' markers.
rlamy
noreply at buildbot.pypy.org
Mon Apr 14 17:57:59 CEST 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: pytest-25
Changeset: r70631:50fea73fc1fe
Date: 2014-04-14 16:56 +0100
http://bitbucket.org/pypy/pypy/changeset/50fea73fc1fe/
Log: Fix creation and use of 'interplevel' and 'applevel' markers.
Filtering on markers needs '-m' option, not '-k'.
diff --git a/pypy/tool/pytest/apptest.py b/pypy/tool/pytest/apptest.py
--- a/pypy/tool/pytest/apptest.py
+++ b/pypy/tool/pytest/apptest.py
@@ -21,11 +21,12 @@
def __init__(self, excinfo):
self.excinfo = excinfo
+marker = py.test.mark.applevel
class AppTestFunction(py.test.collect.Function):
def __init__(self, *args, **kwargs):
super(AppTestFunction, self).__init__(*args, **kwargs)
- self.keywords['applevel'] = True
+ self._request.applymarker(marker)
def _prunetraceback(self, traceback):
return traceback
@@ -116,13 +117,6 @@
class AppClassCollector(PyPyClassCollector):
Instance = AppClassInstance
- def _haskeyword(self, keyword):
- return keyword == 'applevel' or \
- super(AppClassCollector, self)._haskeyword(keyword)
-
- def _keywords(self):
- return super(AppClassCollector, self)._keywords() + ['applevel']
-
def setup(self):
super(AppClassCollector, self).setup()
cls = self.obj
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
@@ -19,10 +19,13 @@
pass
+marker = py.test.mark.interplevel
+
+
class IntTestFunction(py.test.collect.Function):
def __init__(self, *args, **kwargs):
super(IntTestFunction, self).__init__(*args, **kwargs)
- self.keywords['interplevel'] = True
+ self._request.applymarker(marker)
def runtest(self):
try:
@@ -47,11 +50,3 @@
class IntClassCollector(PyPyClassCollector):
Instance = IntInstanceCollector
-
- def _haskeyword(self, keyword):
- return (keyword == 'interplevel' or
- super(IntClassCollector, self)._haskeyword(keyword))
-
- def _keywords(self):
- return super(IntClassCollector, self)._keywords() + ['interplevel']
-
diff --git a/pypy/tool/pytest/test/test_conftest1.py b/pypy/tool/pytest/test/test_conftest1.py
--- a/pypy/tool/pytest/test/test_conftest1.py
+++ b/pypy/tool/pytest/test/test_conftest1.py
@@ -5,27 +5,26 @@
pytest_plugins = "pytester"
class TestPyPyTests:
- def test_selection_by_keyword_interp(self, testdir):
- sorter = testdir.inline_run("-k", "interplevel", innertest, )
+ def test_selection_by_keyword_interp(self, testdir):
+ sorter = testdir.inline_run("-m", "interplevel", innertest, )
passed, skipped, failed = sorter.listoutcomes()
assert len(passed) == 2, len(passed)
- assert not skipped and not failed
+ assert not skipped and not failed
assert "test_something" in passed[0].nodeid
assert "test_method" in passed[1].nodeid
- def test_selection_by_keyword_app(self, testdir):
- sorter = testdir.inline_run("-k", "applevel", innertest)
+ def test_selection_by_keyword_app(self, testdir):
+ sorter = testdir.inline_run("-m", "applevel", innertest)
passed, skipped, failed = sorter.listoutcomes()
assert len(passed) == 2
- assert not skipped and not failed
+ assert not skipped and not failed
assert "app_test_something" in passed[0].nodeid
assert "test_method_app" in passed[1].nodeid
def test_appdirect(self, testdir):
- sorter = testdir.inline_run(innertest, '-k', 'applevel', '--runappdirect')
+ sorter = testdir.inline_run(innertest, '-m', 'applevel', '--runappdirect')
passed, skipped, failed = sorter.listoutcomes()
assert len(passed) == 2
print passed
assert "app_test_something" in passed[0].nodeid
assert "test_method_app" in passed[1].nodeid
-
More information about the pypy-commit
mailing list