rename a number of internal and externally visible variables to use the fixture name

rather than funcargs.  Introduce .funcargnames compatibility attribute for backward compat.
This commit is contained in:
holger krekel
2012-10-05 14:24:44 +02:00
parent 8282efbb40
commit bb07ba7807
33 changed files with 281 additions and 261 deletions

View File

@@ -15,7 +15,7 @@ def test_generative(param1, param2):
assert param1 * 2 < param2
def pytest_generate_tests(metafunc):
if 'param1' in metafunc.funcargnames:
if 'param1' in metafunc.fixturenames:
metafunc.addcall(funcargs=dict(param1=3, param2=6))
class TestFailing(object):

View File

@@ -13,9 +13,9 @@ example: specifying and selecting acceptance tests
help="run (slow) acceptance tests")
def pytest_funcarg__accept(request):
return AcceptFuncarg(request)
return AcceptFixture(request)
class AcceptFuncarg:
class AcceptFixture:
def __init__(self, request):
if not request.config.option.acceptance:
pytest.skip("specify -A to run acceptance tests")
@@ -39,7 +39,7 @@ and the actual test function example:
If you run this test without specifying a command line option
the test will get skipped with an appropriate message. Otherwise
you can start to add convenience and test support methods
to your AcceptFuncarg and drive running of tools or
to your AcceptFixture and drive running of tools or
applications and provide ways to do assertions about
the output.

View File

@@ -84,7 +84,7 @@ Now we add a test configuration like this::
help="run all combinations")
def pytest_generate_tests(metafunc):
if 'param1' in metafunc.funcargnames:
if 'param1' in metafunc.fixturenames:
if metafunc.config.option.all:
end = 5
else:
@@ -213,7 +213,7 @@ creates a database object for the actual test invocations::
# content of conftest.py
def pytest_generate_tests(metafunc):
if 'db' in metafunc.funcargnames:
if 'db' in metafunc.fixturenames:
metafunc.parametrize("db", ['d1', 'd2'], indirect=True)
class DB1: