From 586befb9455e31acb1856b25d06e9352741ed76e Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 19 Oct 2012 10:17:13 +0200 Subject: [PATCH] make usefixtures appear in py.test --markers output --- _pytest/__init__.py | 2 +- _pytest/python.py | 4 ++++ setup.py | 2 +- testing/test_python.py | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 06f440563..e6bf19d80 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.3.0.dev32' +__version__ = '2.3.0.dev33' diff --git a/_pytest/python.py b/_pytest/python.py index 744c182c4..f716c1938 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -101,6 +101,10 @@ def pytest_configure(config): "@parametrize('arg1', [1,2]) would lead to two calls of the decorated " "test function, one with arg1=1 and another with arg1=2." ) + config.addinivalue_line("markers", + "usefixtures(fixturename1, fixturename2, ...): mark tests as needing " + "all of the specified fixtures." + ) def pytest_sessionstart(session): session._fixturemanager = FixtureManager(session) diff --git a/setup.py b/setup.py index 5cf3c4e59..f51408b3c 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.3.0.dev32', + version='2.3.0.dev33', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/test_python.py b/testing/test_python.py index cec277cfb..0227870b5 100644 --- a/testing/test_python.py +++ b/testing/test_python.py @@ -1445,6 +1445,12 @@ class TestMetafuncFunctional: reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + def test_usefixtures_seen_in_showmarkers(self, testdir): + result = testdir.runpytest("--markers") + result.stdout.fnmatch_lines(""" + *usefixtures(fixturename1*mark tests*fixtures* + """) + def test_generate_tests_only_done_in_subdir(self, testdir): sub1 = testdir.mkpydir("sub1") sub2 = testdir.mkpydir("sub2")