Skip to content

Include static prerequisites when selecting dependent tests with -k - #285

Merged
mrbean-bremen merged 3 commits into
pytest-dev:mainfrom
mayankdhingra02:codex/dec03-select-dependencies
Dec 3, 2026
Merged

mrbean-bremen merged 3 commits into
pytest-dev:mainfrom
mayankdhingra02:codex/dec03-select-dependencies

Conversation

@mayankdhingra02

Copy link
Copy Markdown
Contributor

Selecting a dependency-marked test with -k currently leaves its prerequisites deselected, so pytest-dependency skips the selected test. This adds --order-include-dependencies, used with --order-dependencies, to include collected static prerequisites and their transitive dependencies. Default selection stays unchanged.

Addresses #64. Names, scopes and parameterized dependency labels follow pytest-dependency. -m, --deselect and the collected paths remain boundaries; runtime depends() calls and order-only markers do not expand selection. The deprecated pytest 6 expr: suffix filter produces an explicit usage error with the new option because adding earlier prerequisites changes its meaning; normal keyword expressions and legacy negative syntax work.

Validation:

  • All 52 configured tox environments pass, covering CPython 3.10–3.15, PyPy 3.10/3.11 and pytest 6.2–9.2.
  • The repository's pinned hook tools pass. Fresh installed-wheel and rebuilt-sdist suites pass with pytest 9.2 and the minimum 6.2.4 respectively; package metadata checks pass.
  • Combined coverage rises from 99.41% to 99.62% for lines and 96.88% to 97.90% for branches. The new selection module has full line and branch coverage.

Checks ran locally on macOS ARM64; Linux, Windows and Python 3.9 were not run. The existing Python metadata is unchanged.

AI assistance was used for implementation and testing. A separate coding agent reviewed the final diff and exercised the CLI independently.

@mrbean-bremen
mrbean-bremen force-pushed the codex/dec03-select-dependencies branch from 974afa2 to c50be01 Compare December 3, 2026 18:43
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.69%. Comparing base (72b14a6) to head (c50be01).

Files with missing lines Patch % Lines
src/pytest_order/selection.py 91.48% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
- Coverage   98.09%   97.69%   -0.40%     
==========================================
  Files           5        6       +1     
  Lines         681      781     +100     
  Branches      144      167      +23     
==========================================
+ Hits          668      763      +95     
- Misses          4        8       +4     
- Partials        9       10       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrbean-bremen mrbean-bremen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that looks good!

@mrbean-bremen
mrbean-bremen merged commit 8fa65d7 into pytest-dev:main Dec 3, 2026
18 checks passed
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