Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

Pytest 8.4+ no longer allows pytest_plugins in non-top-level conftest files. This was causing test collection to fail with:

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.
  /home/runner/work/readthedocs.org/readthedocs.org/readthedocs/conftest.py

https://docs.pytest.org/en/7.1.x/deprecations.html#pytest-plugins-in-non-top-level-conftest-files

Changes

  • Created /conftest.py with the pytest_plugins = ("sphinx.testing.fixtures",) declaration
  • Removed pytest_plugins from readthedocs/conftest.py, preserving all fixtures

All 2459 tests now collect and run successfully.

Original prompt

Move pytest_plugins to top-level conftest.py for pytest compatibility

This PR moves the pytest_plugins assignment from readthedocs/conftest.py to a new top-level conftest.py file, as required by recent pytest versions. This resolves the error:

Defining 'pytest_plugins' in a non-top-level conftest is no longer supported

Now, all tests can be collected and run as expected with modern pytest.

No functional changes to tests or fixtures; this is a compatibility fix only.

Created from VS Code via the GitHub Pull Request extension.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: ericholscher <25510+ericholscher@users.noreply.github.com>
Copilot AI changed the title [WIP] Move pytest_plugins to top-level conftest.py for compatibility Move pytest_plugins to top-level conftest.py for pytest 8.4+ compatibility Nov 13, 2025
Copilot AI requested a review from ericholscher November 13, 2025 19:42
Copilot finished work on behalf of ericholscher November 13, 2025 19:42
@ericholscher ericholscher marked this pull request as ready for review November 17, 2025 15:09
@ericholscher ericholscher requested a review from a team as a code owner November 17, 2025 15:09
@ericholscher
Copy link
Member

I think this is a real issue -- not sure if we should just move the whole conftest.py to the top-level?

@stsewd
Copy link
Member

stsewd commented Nov 17, 2025

I guess the main thing would be to test if it works well with .com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants