Skip to content

Commit 5c49dea

Browse files
authored
Merge pull request pytest-dev#9513 from pytest-dev/backport-9512-to-7.0.x
[7.0.x] testing: avoid private pluggy attributes in test
2 parents 46c06e7 + a1635ca commit 5c49dea

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

testing/test_config.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,15 +1264,20 @@ def pytest_load_initial_conftests(self):
12641264
m = My()
12651265
pm.register(m)
12661266
hc = pm.hook.pytest_load_initial_conftests
1267-
assert [x.function.__module__ for x in hc._nonwrappers] == [
1268-
"_pytest.config",
1269-
m.__module__,
1270-
"_pytest.legacypath",
1271-
"_pytest.pythonpath",
1267+
hookimpls = [
1268+
(
1269+
hookimpl.function.__module__,
1270+
"wrapper" if hookimpl.hookwrapper else "nonwrapper",
1271+
)
1272+
for hookimpl in hc.get_hookimpls()
12721273
]
1273-
assert [x.function.__module__ for x in hc._wrappers] == [
1274-
"_pytest.capture",
1275-
"_pytest.warnings",
1274+
assert hookimpls == [
1275+
("_pytest.config", "nonwrapper"),
1276+
(m.__module__, "nonwrapper"),
1277+
("_pytest.legacypath", "nonwrapper"),
1278+
("_pytest.pythonpath", "nonwrapper"),
1279+
("_pytest.capture", "wrapper"),
1280+
("_pytest.warnings", "wrapper"),
12761281
]
12771282

12781283

0 commit comments

Comments
 (0)