Replace deprecated "config.option.<name>" usages from docs
This commit is contained in:
parent
1a9bc141a5
commit
f770f16294
|
@ -17,7 +17,7 @@ example: specifying and selecting acceptance tests
|
||||||
|
|
||||||
class AcceptFixture(object):
|
class AcceptFixture(object):
|
||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
if not request.config.option.acceptance:
|
if not request.config.getoption('acceptance'):
|
||||||
pytest.skip("specify -A to run acceptance tests")
|
pytest.skip("specify -A to run acceptance tests")
|
||||||
self.tmpdir = request.config.mktemp(request.function.__name__, numbered=True)
|
self.tmpdir = request.config.mktemp(request.function.__name__, numbered=True)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ Now we add a test configuration like this::
|
||||||
|
|
||||||
def pytest_generate_tests(metafunc):
|
def pytest_generate_tests(metafunc):
|
||||||
if 'param1' in metafunc.fixturenames:
|
if 'param1' in metafunc.fixturenames:
|
||||||
if metafunc.config.option.all:
|
if metafunc.config.getoption('all'):
|
||||||
end = 5
|
end = 5
|
||||||
else:
|
else:
|
||||||
end = 2
|
end = 2
|
||||||
|
|
|
@ -187,7 +187,7 @@ command line option and the parametrization of our test function::
|
||||||
def pytest_generate_tests(metafunc):
|
def pytest_generate_tests(metafunc):
|
||||||
if 'stringinput' in metafunc.fixturenames:
|
if 'stringinput' in metafunc.fixturenames:
|
||||||
metafunc.parametrize("stringinput",
|
metafunc.parametrize("stringinput",
|
||||||
metafunc.config.option.stringinput)
|
metafunc.config.getoption('stringinput'))
|
||||||
|
|
||||||
If we now pass two stringinput values, our test will run twice::
|
If we now pass two stringinput values, our test will run twice::
|
||||||
|
|
||||||
|
|
|
@ -331,11 +331,11 @@ string value of ``Hello World!`` if we do not supply a value or ``Hello
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def hello(request):
|
def hello(request):
|
||||||
name = request.config.option.name
|
name = request.config.getoption('name')
|
||||||
|
|
||||||
def _hello(name=None):
|
def _hello(name=None):
|
||||||
if not name:
|
if not name:
|
||||||
name = request.config.option.name
|
name = request.config.getoption('name')
|
||||||
return "Hello {name}!".format(name=name)
|
return "Hello {name}!".format(name=name)
|
||||||
|
|
||||||
return _hello
|
return _hello
|
||||||
|
|
Loading…
Reference in New Issue