Remove funcargnames compatibility property
This commit is contained in:
parent
c98525bd21
commit
98530184a5
|
@ -0,0 +1,4 @@
|
|||
As per our policy, the following features have been deprecated in the 5.X series and are now
|
||||
removed:
|
||||
|
||||
* The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute.
|
|
@ -127,20 +127,6 @@ Services known to support the ``xunit2`` format:
|
|||
* `Azure Pipelines <https://azure.microsoft.com/en-us/services/devops/pipelines>`__.
|
||||
|
||||
|
||||
``funcargnames`` alias for ``fixturenames``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 5.0
|
||||
|
||||
The ``FixtureRequest``, ``Metafunc``, and ``Function`` classes track the names of
|
||||
their associated fixtures, with the aptly-named ``fixturenames`` attribute.
|
||||
|
||||
Prior to pytest 2.3, this attribute was named ``funcargnames``, and we have kept
|
||||
that as an alias since. It is finally due for removal, as it is often confusing
|
||||
in places where we or plugin authors must distinguish between fixture names and
|
||||
names supplied by non-fixture things such as ``pytest.mark.parametrize``.
|
||||
|
||||
|
||||
Result log (``--result-log``)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -176,6 +162,19 @@ Removed Features
|
|||
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
|
||||
an appropriate period of deprecation has passed.
|
||||
|
||||
``funcargnames`` alias for ``fixturenames``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionremoved:: 6.0
|
||||
|
||||
The ``FixtureRequest``, ``Metafunc``, and ``Function`` classes track the names of
|
||||
their associated fixtures, with the aptly-named ``fixturenames`` attribute.
|
||||
|
||||
Prior to pytest 2.3, this attribute was named ``funcargnames``, and we have kept
|
||||
that as an alias since. It is finally due for removal, as it is often confusing
|
||||
in places where we or plugin authors must distinguish between fixture names and
|
||||
names supplied by non-fixture things such as ``pytest.mark.parametrize``.
|
||||
|
||||
|
||||
``pytest.config`` global
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -19,10 +19,6 @@ DEPRECATED_EXTERNAL_PLUGINS = {
|
|||
"pytest_faulthandler",
|
||||
}
|
||||
|
||||
FUNCARGNAMES = PytestDeprecationWarning(
|
||||
"The `funcargnames` attribute was an alias for `fixturenames`, "
|
||||
"since pytest 2.3 - use the newer attribute instead."
|
||||
)
|
||||
|
||||
FILLFUNCARGS = PytestDeprecationWarning(
|
||||
"The `_fillfuncargs` function is deprecated, use "
|
||||
|
|
|
@ -47,7 +47,6 @@ from _pytest.config import _PluggyPlugin
|
|||
from _pytest.config import Config
|
||||
from _pytest.config.argparsing import Parser
|
||||
from _pytest.deprecated import FIXTURE_POSITIONAL_ARGUMENTS
|
||||
from _pytest.deprecated import FUNCARGNAMES
|
||||
from _pytest.mark import ParameterSet
|
||||
from _pytest.outcomes import fail
|
||||
from _pytest.outcomes import TEST_OUTCOME
|
||||
|
@ -457,12 +456,6 @@ class FixtureRequest:
|
|||
result.extend(set(self._fixture_defs).difference(result))
|
||||
return result
|
||||
|
||||
@property
|
||||
def funcargnames(self) -> List[str]:
|
||||
"""Alias attribute for ``fixturenames`` for pre-2.3 compatibility."""
|
||||
warnings.warn(FUNCARGNAMES, stacklevel=2)
|
||||
return self.fixturenames
|
||||
|
||||
@property
|
||||
def node(self):
|
||||
"""Underlying collection node (depends on current request scope)."""
|
||||
|
|
|
@ -53,7 +53,6 @@ from _pytest.config import ExitCode
|
|||
from _pytest.config import hookimpl
|
||||
from _pytest.config.argparsing import Parser
|
||||
from _pytest.deprecated import FSCOLLECTOR_GETHOOKPROXY_ISINITPATH
|
||||
from _pytest.deprecated import FUNCARGNAMES
|
||||
from _pytest.fixtures import FuncFixtureInfo
|
||||
from _pytest.main import Session
|
||||
from _pytest.mark import MARK_GEN
|
||||
|
@ -906,12 +905,6 @@ class Metafunc:
|
|||
self._calls = [] # type: List[CallSpec2]
|
||||
self._arg2fixturedefs = fixtureinfo.name2fixturedefs
|
||||
|
||||
@property
|
||||
def funcargnames(self) -> List[str]:
|
||||
"""Alias attribute for ``fixturenames`` for pre-2.3 compatibility."""
|
||||
warnings.warn(FUNCARGNAMES, stacklevel=2)
|
||||
return self.fixturenames
|
||||
|
||||
def parametrize(
|
||||
self,
|
||||
argnames: Union[str, List[str], Tuple[str, ...]],
|
||||
|
@ -1568,12 +1561,6 @@ class Function(PyobjMixin, nodes.Item):
|
|||
"""(compatonly) for code expecting pytest-2.2 style request objects."""
|
||||
return self
|
||||
|
||||
@property
|
||||
def funcargnames(self) -> List[str]:
|
||||
"""Alias attribute for ``fixturenames`` for pre-2.3 compatibility."""
|
||||
warnings.warn(FUNCARGNAMES, stacklevel=2)
|
||||
return self.fixturenames
|
||||
|
||||
def runtest(self) -> None:
|
||||
"""Execute the underlying test function."""
|
||||
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
|
||||
|
|
|
@ -815,28 +815,6 @@ class TestRequestBasic:
|
|||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_funcargnames_compatattr(self, testdir):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
def pytest_generate_tests(metafunc):
|
||||
with pytest.warns(pytest.PytestDeprecationWarning):
|
||||
assert metafunc.funcargnames == metafunc.fixturenames
|
||||
@pytest.fixture
|
||||
def fn(request):
|
||||
with pytest.warns(pytest.PytestDeprecationWarning):
|
||||
assert request._pyfuncitem.funcargnames == \
|
||||
request._pyfuncitem.fixturenames
|
||||
with pytest.warns(pytest.PytestDeprecationWarning):
|
||||
return request.funcargnames, request.fixturenames
|
||||
|
||||
def test_hello(fn):
|
||||
assert fn[0] == fn[1]
|
||||
"""
|
||||
)
|
||||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
def test_setupdecorator_and_xunit(self, testdir):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue