Skip to content

Fix terminal path for tests outside configured root - #15377

Draft
sxwangsxwang1 wants to merge 1 commit into
pytest-dev:mainfrom
sxwangsxwang1:fix-11186-outside-root-display
Draft

sxwangsxwang1 wants to merge 1 commit into
pytest-dev:mainfrom
sxwangsxwang1:fix-11186-outside-root-display

Conversation

@sxwangsxwang1

Copy link
Copy Markdown

Summary

  • Use the report's actual file location for terminal output when a test file is outside the configured root directory.
  • Preserve the existing logical node ID and symlink display behavior.
  • Add a regression test for normal, verbose, and summary output; update an older test that expected a nonexistent path.

Fixes #11186.

Reproduction

From a directory containing settings/pytest.ini and test/test_hello.py, run pytest -c settings/pytest.ini -v. Previously the terminal showed settings/test/test_hello.py; it now shows the real path, test/test_hello.py.

Verification

  • python -m pytest -q testing/ --disable-warnings --maxfail=1: 4728 passed, 51 skipped, 17 xfailed, 4 xpassed.
  • pre-commit run --files AUTHORS src/_pytest/terminal.py testing/test_terminal.py testing/test_session.py changelog/11186.bugfix.rst: passed.

This change was prepared with AI assistance. The PR is a draft for contributor review before requesting maintainer review.

@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 11, 2026

This branch has not been deployed

No deployments
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.

rootdir is not considered as expected

1 participant