From 2a22b81240f7c9dbb8eb24db90c57df9a2d7d4a4 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 14 Jan 2022 18:09:10 +0200 Subject: [PATCH] Merge pull request #9512 from bluetech/pluggy-private testing: avoid private pluggy attributes in test (cherry picked from commit a6310c20c17658aaac02f274de53487d2f9ff854) --- testing/test_config.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/testing/test_config.py b/testing/test_config.py index 06cec9113..1cb0c1893 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1247,9 +1247,19 @@ def test_load_initial_conftest_last_ordering(_config_for_test): m = My() pm.register(m) hc = pm.hook.pytest_load_initial_conftests - values = hc._nonwrappers + hc._wrappers - expected = ["_pytest.config", m.__module__, "_pytest.capture", "_pytest.warnings"] - assert [x.function.__module__ for x in values] == expected + hookimpls = [ + ( + hookimpl.function.__module__, + "wrapper" if hookimpl.hookwrapper else "nonwrapper", + ) + for hookimpl in hc.get_hookimpls() + ] + assert hookimpls == [ + ("_pytest.config", "nonwrapper"), + (m.__module__, "nonwrapper"), + ("_pytest.capture", "wrapper"), + ("_pytest.warnings", "wrapper"), + ] def test_get_plugin_specs_as_list() -> None: