Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures
This commit is contained in:
+9
-3
@@ -878,7 +878,12 @@ def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=N
|
||||
else:
|
||||
return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
|
||||
|
||||
|
||||
defaultfuncargprefixmarker = fixture()
|
||||
funcarg_prefix_warning = (
|
||||
'{name}: declaring fixtures using "pytest_funcarg__" prefix is deprecated '
|
||||
'and scheduled to be removed in pytest 4.0. '
|
||||
'Please remove the prefix and use the @pytest.fixture decorator instead.')
|
||||
|
||||
|
||||
@fixture(scope="session")
|
||||
@@ -887,8 +892,6 @@ def pytestconfig(request):
|
||||
return request.config
|
||||
|
||||
|
||||
|
||||
|
||||
class FixtureManager:
|
||||
"""
|
||||
pytest fixtures definitions and information is stored and managed
|
||||
@@ -1063,6 +1066,7 @@ class FixtureManager:
|
||||
if not callable(obj):
|
||||
continue
|
||||
marker = defaultfuncargprefixmarker
|
||||
self.config.warn('C1', funcarg_prefix_warning.format(name=name))
|
||||
name = name[len(self._argprefix):]
|
||||
elif not isinstance(marker, FixtureFunctionMarker):
|
||||
# magic globals with __getattr__ might have got us a wrong
|
||||
@@ -1071,7 +1075,9 @@ class FixtureManager:
|
||||
else:
|
||||
if marker.name:
|
||||
name = marker.name
|
||||
assert not name.startswith(self._argprefix), name
|
||||
msg = 'fixtures cannot have "pytest_funcarg__" prefix ' \
|
||||
'and be decorated with @pytest.fixture:\n%s' % name
|
||||
assert not name.startswith(self._argprefix), msg
|
||||
|
||||
def new_fixture_def(name, scope):
|
||||
"""Create and registers a new FixtureDef with given name and scope."""
|
||||
|
||||
Reference in New Issue
Block a user