Plugins loaded via PYTEST_PLUGINS
or pytest_plugins
are not reported · Issue #12615 · pytest-dev/pytest (original) (raw)
- a detailed description of the bug or problem you are having
- output of
pip list
from the virtual environment you are using - pytest and operating system versions
- minimal example if possible
When I load a plugin using the PYTEST_ADDOPTS
environment variable then the plugin is properly reported in the list of plugins:
$ env - PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTEST_ADDOPTS='-p randomly' pytest --setup-plan
============================= test session starts ==============================
platform sunos5 -- Python 3.9.19, pytest-8.2.2, pluggy-1.5.0
Using --randomly-seed=2747766829
rootdir: /tmp/test
plugins: randomly-3.15.0
collected 0 items
============================ no tests ran in 0.03s =============================
$
When I try to achieve the same using the PYTEST_PLUGINS
environment variable then the plugin is not listed in the list of plugins:
$ env - PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTEST_PLUGINS=pytest_randomly pytest --setup-plan
============================= test session starts ==============================
platform sunos5 -- Python 3.9.19, pytest-8.2.2, pluggy-1.5.0
Using --randomly-seed=3835907952
rootdir: /tmp/test
collected 0 items
============================ no tests ran in 0.03s =============================
$
but the plugin is apparently properly loaded (please note --randomly-seed
).
It would be great to see plugins loaded via the PYTEST_PLUGINS
environment variable reported too to avoid confusion.
EDIT: the same problem is seen when the pytest_plugins
global variable is used to load plugins.