Skip to content

Commit 0b0e2d2

Browse files
committed
Remove deprecated _fillfuncargs function
1 parent 4d7a962 commit 0b0e2d2

File tree

9 files changed

+8
-158
lines changed

9 files changed

+8
-158
lines changed

doc/en/deprecations.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,18 @@ The ``pytest.collect`` module is no longer part of the public API, all its names
269269
should now be imported from ``pytest`` directly instead.
270270

271271

272+
Removed Features
273+
----------------
274+
275+
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
276+
an appropriate period of deprecation has passed.
277+
278+
272279
The ``pytest._fillfuncargs`` function
273280
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
274281

275282
.. deprecated:: 6.0
283+
.. versionremoved:: 7.0
276284

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

@@ -281,12 +289,6 @@ it, use `function._request._fillfixtures()` instead, though note this is not
281289
a public API and may break in the future.
282290

283291

284-
Removed Features
285-
----------------
286-
287-
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
288-
an appropriate period of deprecation has passed.
289-
290292
``--no-print-logs`` command-line option
291293
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292294

doc/en/how-to/plugins.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ Here is a little annotated list for some popular plugins:
5151
* :pypi:`pytest-flakes`:
5252
check source code with pyflakes.
5353

54-
* :pypi:`oejskit`:
55-
a plugin to run javascript unittests in live browsers.
56-
5754
To see a complete list of all plugins with their latest testing
5855
status against different pytest and Python versions, please visit
5956
:ref:`plugin-list`.

src/_pytest/deprecated.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
}
2525

2626

27-
FILLFUNCARGS = UnformattedWarning(
28-
PytestRemovedIn7Warning,
29-
"{name} is deprecated, use "
30-
"function._request._fillfixtures() instead if you cannot avoid reaching into internals.",
31-
)
32-
3327
PYTEST_COLLECT_MODULE = UnformattedWarning(
3428
PytestRemovedIn7Warning,
3529
"pytest.collect.{name} was moved to pytest.{name}\n"

src/_pytest/fixtures.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
from _pytest.config import Config
5353
from _pytest.config.argparsing import Parser
5454
from _pytest.deprecated import check_ispytest
55-
from _pytest.deprecated import FILLFUNCARGS
5655
from _pytest.deprecated import YIELD_FIXTURE
5756
from _pytest.mark import Mark
5857
from _pytest.mark import ParameterSet
@@ -73,7 +72,6 @@
7372
from _pytest.scope import _ScopeName
7473
from _pytest.main import Session
7574
from _pytest.python import CallSpec2
76-
from _pytest.python import Function
7775
from _pytest.python import Metafunc
7876

7977

@@ -352,41 +350,6 @@ def reorder_items_atscope(
352350
return items_done
353351

354352

355-
def _fillfuncargs(function: "Function") -> None:
356-
"""Fill missing fixtures for a test function, old public API (deprecated)."""
357-
warnings.warn(FILLFUNCARGS.format(name="pytest._fillfuncargs()"), stacklevel=2)
358-
_fill_fixtures_impl(function)
359-
360-
361-
def fillfixtures(function: "Function") -> None:
362-
"""Fill missing fixtures for a test function (deprecated)."""
363-
warnings.warn(
364-
FILLFUNCARGS.format(name="_pytest.fixtures.fillfixtures()"), stacklevel=2
365-
)
366-
_fill_fixtures_impl(function)
367-
368-
369-
def _fill_fixtures_impl(function: "Function") -> None:
370-
"""Internal implementation to fill fixtures on the given function object."""
371-
try:
372-
request = function._request
373-
except AttributeError:
374-
# XXX this special code path is only expected to execute
375-
# with the oejskit plugin. It uses classes with funcargs
376-
# and we thus have to work a bit to allow this.
377-
fm = function.session._fixturemanager
378-
assert function.parent is not None
379-
fi = fm.getfixtureinfo(function.parent, function.obj, None)
380-
function._fixtureinfo = fi
381-
request = function._request = FixtureRequest(function, _ispytest=True)
382-
fm.session._setupstate.setup(function)
383-
request._fillfixtures()
384-
# Prune out funcargs for jstests.
385-
function.funcargs = {name: function.funcargs[name] for name in fi.argnames}
386-
else:
387-
request._fillfixtures()
388-
389-
390353
def get_direct_param_fixture_func(request):
391354
return request.param
392355

src/pytest/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from _pytest.config.argparsing import OptionGroup
2020
from _pytest.config.argparsing import Parser
2121
from _pytest.debugging import pytestPDB as __pytestPDB
22-
from _pytest.fixtures import _fillfuncargs
2322
from _pytest.fixtures import fixture
2423
from _pytest.fixtures import FixtureLookupError
2524
from _pytest.fixtures import FixtureRequest
@@ -81,7 +80,6 @@
8180

8281
__all__ = [
8382
"__version__",
84-
"_fillfuncargs",
8583
"approx",
8684
"Cache",
8785
"CallInfo",

src/pytest/collect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"Item",
1616
"Class",
1717
"File",
18-
"_fillfuncargs",
1918
]
2019

2120

testing/deprecated_test.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
import warnings
44
from pathlib import Path
5-
from unittest import mock
65

76
import pytest
87
from _pytest import deprecated
@@ -28,30 +27,6 @@ def test_external_plugins_integrated(pytester: Pytester, plugin) -> None:
2827
pytester.parseconfig("-p", plugin)
2928

3029

31-
def test_fillfuncargs_is_deprecated() -> None:
32-
with pytest.warns(
33-
pytest.PytestDeprecationWarning,
34-
match=re.escape(
35-
"pytest._fillfuncargs() is deprecated, use "
36-
"function._request._fillfixtures() instead if you cannot avoid reaching into internals."
37-
),
38-
):
39-
pytest._fillfuncargs(mock.Mock())
40-
41-
42-
def test_fillfixtures_is_deprecated() -> None:
43-
import _pytest.fixtures
44-
45-
with pytest.warns(
46-
pytest.PytestDeprecationWarning,
47-
match=re.escape(
48-
"_pytest.fixtures.fillfixtures() is deprecated, use "
49-
"function._request._fillfixtures() instead if you cannot avoid reaching into internals."
50-
),
51-
):
52-
_pytest.fixtures.fillfixtures(mock.Mock())
53-
54-
5530
def test_minus_k_dash_is_deprecated(pytester: Pytester) -> None:
5631
threepass = pytester.makepyfile(
5732
test_threepass="""

testing/python/fixtures.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ class T:
103103

104104
@pytest.mark.pytester_example_path("fixtures/fill_fixtures")
105105
class TestFillFixtures:
106-
def test_fillfuncargs_exposed(self):
107-
# used by oejskit, kept for compatibility
108-
assert pytest._fillfuncargs == fixtures._fillfuncargs
109-
110106
def test_funcarg_lookupfails(self, pytester: Pytester) -> None:
111107
pytester.copy_example()
112108
result = pytester.runpytest() # "--collect-only")

testing/python/integration.py

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,10 @@
1-
from typing import Any
2-
31
import pytest
4-
from _pytest import runner
52
from _pytest._code import getfslineno
63
from _pytest.fixtures import getfixturemarker
74
from _pytest.pytester import Pytester
85
from _pytest.python import Function
96

107

11-
class TestOEJSKITSpecials:
12-
def test_funcarg_non_pycollectobj(
13-
self, pytester: Pytester, recwarn
14-
) -> None: # rough jstests usage
15-
pytester.makeconftest(
16-
"""
17-
import pytest
18-
def pytest_pycollect_makeitem(collector, name, obj):
19-
if name == "MyClass":
20-
return MyCollector.from_parent(collector, name=name)
21-
class MyCollector(pytest.Collector):
22-
def reportinfo(self):
23-
return self.path, 3, "xyz"
24-
"""
25-
)
26-
modcol = pytester.getmodulecol(
27-
"""
28-
import pytest
29-
@pytest.fixture
30-
def arg1(request):
31-
return 42
32-
class MyClass(object):
33-
pass
34-
"""
35-
)
36-
# this hook finds funcarg factories
37-
rep = runner.collect_one_node(collector=modcol)
38-
# TODO: Don't treat as Any.
39-
clscol: Any = rep.result[0]
40-
clscol.obj = lambda arg1: None
41-
clscol.funcargs = {}
42-
pytest._fillfuncargs(clscol)
43-
assert clscol.funcargs["arg1"] == 42
44-
45-
def test_autouse_fixture(
46-
self, pytester: Pytester, recwarn
47-
) -> None: # rough jstests usage
48-
pytester.makeconftest(
49-
"""
50-
import pytest
51-
def pytest_pycollect_makeitem(collector, name, obj):
52-
if name == "MyClass":
53-
return MyCollector.from_parent(collector, name=name)
54-
class MyCollector(pytest.Collector):
55-
def reportinfo(self):
56-
return self.path, 3, "xyz"
57-
"""
58-
)
59-
modcol = pytester.getmodulecol(
60-
"""
61-
import pytest
62-
@pytest.fixture(autouse=True)
63-
def hello():
64-
pass
65-
@pytest.fixture
66-
def arg1(request):
67-
return 42
68-
class MyClass(object):
69-
pass
70-
"""
71-
)
72-
# this hook finds funcarg factories
73-
rep = runner.collect_one_node(modcol)
74-
# TODO: Don't treat as Any.
75-
clscol: Any = rep.result[0]
76-
clscol.obj = lambda: None
77-
clscol.funcargs = {}
78-
pytest._fillfuncargs(clscol)
79-
assert not clscol.funcargs
80-
81-
828
def test_wrapped_getfslineno() -> None:
839
def func():
8410
pass

0 commit comments

Comments
 (0)