Skip to content

Reuse parent collection for explicit file arguments - #15251

Open
wpyaoxueros wants to merge 2 commits into
pytest-dev:mainfrom
wpyaoxueros:codex/explicit-parent-cache
Open

wpyaoxueros wants to merge 2 commits into
pytest-dev:mainfrom
wpyaoxueros:codex/explicit-parent-cache

Conversation

@wpyaoxueros

@wpyaoxueros wpyaoxueros commented Oct 23, 2026 •

Copy link
Copy Markdown

Fixes #15221.

Reuse a parent directory's collection report for explicit file arguments unless --keep-duplicates requires fresh collection. A regression selects four of eight sibling test files and checks that the collection hook sees the directory once rather than once per argument.

This is an alternative to the existing #15228, which addresses the same collection overhead. That PR uses per-argument occurrence checks; this patch uses the existing keepduplicates option to retain the uncached overlapping-argument path. I welcome maintainer guidance on which approach is preferable.

Remote Linux / Python 3.13.16 validation against main 4088e1a84:

  • Identical added regression: fails on unchanged source, passes with the patch.
  • Collection module: 115 passed, 3 skipped, 1 xfailed; rerun with CI's PYTHONWARNDEFAULTENCODING=1 after explicitly specifying UTF-8 in the regression.
  • Full suite: 4700 passed, 47 skipped, 15 xfailed, 5 xpassed (exit 0).
  • Applicable changed-file pre-commit hooks, including Ruff, mypy and spelling: passed. Workflow-only zizmor was not run; no workflow files change.

Windows was not tested locally. The release fragment is named 15251.bugfix.rst.

AI disclosure: Codex prepared the code and tests, ran the remote validation and assisted with this description. Huashuo approved author responsibility for the reviewed patch; this does not claim that Huashuo personally ran the tests.

AI assistance: Codex helped implement and validate this change. Human author responsibility was confirmed by Huashuo for the reviewed diff.
@wpyaoxueros
wpyaoxueros force-pushed the codex/explicit-parent-cache branch from 23d5f6a to 0501b7a Compare October 23, 2026 11:26
Fix EncodingWarning under the CI PYTHONWARNDEFAULTENCODING setting. Codex assisted with the test-only update and remote validation.

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

1 participant