fixtures: deprecate pytest._fillfuncargs function

This function is exposed and kept alive for the oejskit plugin which is
abandoned and no longer works with recent plugins, so let's prepare to
completely remove it.
This commit is contained in:
Ran Benita
2020-04-17 16:05:43 +03:00
parent 7d5f5a8785
commit 907e29a47b
8 changed files with 41 additions and 6 deletions

View File

@@ -25,6 +25,11 @@ FUNCARGNAMES = PytestDeprecationWarning(
"since pytest 2.3 - use the newer attribute instead."
)
FILLFUNCARGS = PytestDeprecationWarning(
"The `_fillfuncargs` function is deprecated, use "
"function._request._fillfixtures() instead if you must."
)
RESULT_LOG = PytestDeprecationWarning(
"--result-log is deprecated, please try the new pytest-reportlog plugin.\n"
"See https://docs.pytest.org/en/latest/deprecations.html#result-log-result-log for more information."

View File

@@ -28,6 +28,7 @@ from _pytest.compat import is_generator
from _pytest.compat import NOTSET
from _pytest.compat import safe_getattr
from _pytest.compat import TYPE_CHECKING
from _pytest.deprecated import FILLFUNCARGS
from _pytest.deprecated import FIXTURE_POSITIONAL_ARGUMENTS
from _pytest.deprecated import FUNCARGNAMES
from _pytest.mark import ParameterSet
@@ -276,6 +277,7 @@ def reorder_items_atscope(items, argkeys_cache, items_by_argkey, scopenum):
def fillfixtures(function):
""" fill missing funcargs for a test function. """
warnings.warn(FILLFUNCARGS, stacklevel=2)
try:
request = function._request
except AttributeError:

View File

@@ -1535,7 +1535,7 @@ class Function(PyobjMixin, nodes.Item):
if isinstance(self.parent, Instance):
self.parent.newinstance()
self.obj = self._getobj()
fixtures.fillfixtures(self)
self._request._fillfixtures()
def _prunetraceback(self, excinfo: ExceptionInfo) -> None:
if hasattr(self, "_obj") and not self.config.getoption("fulltrace", False):