pytest
pytest copied to clipboard
pytest_plugins bug
Hi, There seems to be a change between version 7.1 and version 7.0 that causes pytest_plugins to be bugged.
I understand that defining 'pytest_plugins' in a non-top-level conftest is no longer supported since a long time back, but something changed in the behavior between version 7.0 and 7.1 that causes the problem below:
$ python -m my_package.tests
pytest c:/workspace/venv/lib/site-packages/my_package/tests
============================= test session starts =============================
platform win32 -- Python 3.10.4, pytest-7.1.1, pluggy-0.13.1
Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket=<bucket_type>
rootdir: c:\workspace\venv\lib\site-packages\my_package\tests, configfile: pytest.ini
plugins: clarity-1.0.1, cov-2.12.1, datadir-1.3.1, flake8-1.1.1, httpserver-0.3.8, mock-3.7.0, random-order-1.0.4
collected 0 items / 1 error
=================================== ERRORS ====================================
________________________ ERROR collecting test session ________________________
Defining 'pytest_plugins' in a non-top-level conftest is no longer supported:
It affects the entire test suite instead of just below the conftest as expected.
c:\workspace\venv\lib\site-packages\my_package\tests\conftest.py
Please move it to a top level conftest file at the rootdir:
c:\workspace\venv\lib\site-packages\my_package\tests
For more information, visit:
https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-files
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.20s ===============================
As you can see, pytest wants me to move the file to the same location it already exists at... This did not happened with version 7.0.
Kindly revert this bug.