Merge pull request #5494 from Zac-HD/funcargnames-to-fixturenames

Deprecate funcargnames alias for fixturenames
This commit is contained in:
Bruno Oliveira
2019-06-26 21:13:59 -03:00
committed by GitHub
7 changed files with 35 additions and 6 deletions

View File

@@ -325,4 +325,8 @@ class FuncargnamesCompatAttr:
@property
def funcargnames(self):
""" alias attribute for ``fixturenames`` for pre-2.3 compatibility"""
import warnings
from _pytest.deprecated import FUNCARGNAMES
warnings.warn(FUNCARGNAMES, stacklevel=2)
return self.fixturenames

View File

@@ -40,6 +40,11 @@ GETFUNCARGVALUE = RemovedInPytest4Warning(
"getfuncargvalue is deprecated, use getfixturevalue"
)
FUNCARGNAMES = PytestDeprecationWarning(
"The `funcargnames` attribute was an alias for `fixturenames`, "
"since pytest 2.3 - use the newer attribute instead."
)
RAISES_MESSAGE_PARAMETER = PytestDeprecationWarning(
"The 'message' parameter is deprecated.\n"
"(did you mean to use `match='some regex'` to check the exception message?)\n"

View File

@@ -654,7 +654,7 @@ class SubRequest(FixtureRequest):
# if the executing fixturedef was not explicitly requested in the argument list (via
# getfixturevalue inside the fixture call) then ensure this fixture def will be finished
# first
if fixturedef.argname not in self.funcargnames:
if fixturedef.argname not in self.fixturenames:
fixturedef.addfinalizer(
functools.partial(self._fixturedef.finish, request=self)
)