make usefixtures appear in py.test --markers output

This commit is contained in:
holger krekel 2012-10-19 10:17:13 +02:00
parent b0b6695538
commit 586befb945
4 changed files with 12 additions and 2 deletions

View File

@ -1,2 +1,2 @@
#
__version__ = '2.3.0.dev32'
__version__ = '2.3.0.dev33'

View File

@ -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)

View File

@ -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'],

View File

@ -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")