From 8c5c1bbf706e5c316f66e01f04f92c5632e94419 Mon Sep 17 00:00:00 2001 From: PranavAchar01 Date: Tue, 7 Jul 2026 00:27:00 -0700 Subject: [PATCH] doc: fix pytest_load_initial_conftests example referring to conftest.py The 'Dynamically adding command line options' example defines pytest_load_initial_conftests under a '# installable external plugin' comment but the following prose called it 'the above conftest.py'. This contradicts the hook reference, which states the hook is not called for conftest files. Refer to it as a plugin instead. Closes #4482 --- changelog/4482.doc.rst | 5 +++++ doc/en/example/simple.rst | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/4482.doc.rst diff --git a/changelog/4482.doc.rst b/changelog/4482.doc.rst new file mode 100644 index 00000000000..d7849f40c9e --- /dev/null +++ b/changelog/4482.doc.rst @@ -0,0 +1,5 @@ +Corrected the "Dynamically adding command line options" example so it no longer +refers to the ``pytest_load_initial_conftests`` hook as living in a +``conftest.py``. As noted in the hook reference, ``pytest_load_initial_conftests`` +is not called for ``conftest.py`` files and must be provided by an installable +plugin. diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index dff53488c88..df16637591e 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -229,7 +229,7 @@ the command line arguments before they get processed: If you have the :pypi:`xdist plugin ` installed you will now always perform test runs using a number of subprocesses close to your CPU. Running in an empty -directory with the above conftest.py: +directory with the above plugin: .. code-block:: pytest