Skip to content

Commit

Permalink
fixtures: deprecate pytest._fillfuncargs function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bluetech committed Apr 17, 2020
1 parent f3c4723 commit 8b579aa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/7097.deprecation.rst
@@ -0,0 +1,6 @@
The ``pytest._fillfuncargs`` function is now deprecated. This function was kept
for backward compatibility with an older plugin.

It's functionality is not meant to be used directly, but if you must replace
it, use `function._request._fillfixtures()` instead, though note this is not
a public API and may break in the future.
13 changes: 13 additions & 0 deletions doc/en/deprecations.rst
Expand Up @@ -20,6 +20,19 @@ Below is a complete list of all pytest features which are considered deprecated.
:ref:`standard warning filters <warnings>`.


The ``pytest._fillfuncargs`` function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. deprecated:: 5.5

This function was kept for backward compatibility with an older plugin.

It's functionality is not meant to be used directly, but if you must replace
it, use `function._request._fillfixtures()` instead, though note this is not
a public API and may break in the future.



``--no-print-logs`` command-line option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
5 changes: 5 additions & 0 deletions src/_pytest/deprecated.py
Expand Up @@ -25,6 +25,11 @@
"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."
Expand Down
2 changes: 2 additions & 0 deletions src/_pytest/fixtures.py
Expand Up @@ -28,6 +28,7 @@
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
Expand Down Expand Up @@ -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)
function._request._fillfixtures()


Expand Down
9 changes: 9 additions & 0 deletions testing/deprecated_test.py
@@ -1,4 +1,5 @@
import inspect
from unittest import mock

import pytest
from _pytest import deprecated
Expand Down Expand Up @@ -146,3 +147,11 @@ def test_foo():
)

assert_no_print_logs(testdir, ())


def test__fillfuncargs_is_deprecated() -> None:
with pytest.warns(
pytest.PytestDeprecationWarning,
match="The `_fillfuncargs` function is deprecated",
):
pytest._fillfuncargs(mock.Mock())

0 comments on commit 8b579aa

Please sign in to comment.