Skip to content

Fix fixture visibility with doctest module collection#14545

Closed
bubaizhanshen wants to merge 1 commit into
pytest-dev:mainfrom
bubaizhanshen:fix-doctest-module-fixtures
Closed

Fix fixture visibility with doctest module collection#14545
bubaizhanshen wants to merge 1 commit into
pytest-dev:mainfrom
bubaizhanshen:fix-doctest-module-fixtures

Conversation

@bubaizhanshen
Copy link
Copy Markdown

Summary

  • include the fixture visibility scope in parsefactories() duplicate tracking
  • allow the same module object to be parsed separately for DoctestModule and Module collectors
  • add a regression test for --doctest-modules hiding fixtures from normal tests

Fixes #14533

Tests

  • PYTHONPATH=/tmp/stubreadline /tmp/pytest-venv/bin/python -m pytest -o minversion=0 testing/test_doctest.py -q
  • PYTHONPATH=/tmp/stubreadline /tmp/pytest-venv/bin/python -m pytest -o minversion=0 testing/python/fixtures.py::TestFixtureManagerParseFactories testing/deprecated_test.py::TestFixtureNodeidDeprecations -q
  • PYTHONPATH=/tmp/stubreadline /tmp/pytest-venv/bin/python -m ruff check src/_pytest/fixtures.py testing/test_doctest.py
  • PYTHONPATH=/tmp/stubreadline /tmp/pytest-venv/bin/python -m ruff format --check src/_pytest/fixtures.py testing/test_doctest.py
  • PYTHONPATH=/tmp/stubreadline /tmp/pytest-venv/bin/python -m py_compile src/_pytest/fixtures.py testing/test_doctest.py && git diff --check

@bubaizhanshen bubaizhanshen force-pushed the fix-doctest-module-fixtures branch from 67ea67c to 1ad8c86 Compare June 1, 2026 15:09
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 1, 2026
@bluetech
Copy link
Copy Markdown
Member

bluetech commented Jun 2, 2026

Thanks but there's an open PR #14540 for this issue

@bluetech bluetech closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enabling doctest-modules causes fixture to not be found

2 participants