From 6165ebc7195c3a76fba0361cad01d43c7150c622 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Tue, 3 Oct 2023 09:23:17 +0200 Subject: [PATCH] [test] Use get_hookimpls method instead of the private attribute directly --- docs/changelog/2649.bugfix.rst | 1 + tests/conftest.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2649.bugfix.rst diff --git a/docs/changelog/2649.bugfix.rst b/docs/changelog/2649.bugfix.rst new file mode 100644 index 000000000..32cbb383c --- /dev/null +++ b/docs/changelog/2649.bugfix.rst @@ -0,0 +1 @@ +Use get_hookimpls method instead of the private attribute in tests. diff --git a/tests/conftest.py b/tests/conftest.py index 1175aa952..bec6d8f00 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -25,7 +25,7 @@ def pytest_configure(config): """Ensure randomly is called before we re-order""" manager = config.pluginmanager - order = manager.hook.pytest_collection_modifyitems._hookimpls # noqa: SLF001 + order = manager.hook.pytest_collection_modifyitems.get_hookimpls() dest = next((i for i, p in enumerate(order) if p.plugin is manager.getplugin("randomly")), None) if dest is not None: from_pos = next(i for i, p in enumerate(order) if p.plugin is manager.getplugin(__file__))