Skip to content

pytest_plugin(fix[pytest_ignore_collect]): abstain with None#544

Merged
tony merged 3 commits into
masterfrom
fix/pytest-ignore-collect-firstresult
Jul 11, 2026
Merged

pytest_plugin(fix[pytest_ignore_collect]): abstain with None#544
tony merged 3 commits into
masterfrom
fix/pytest-ignore-collect-firstresult

Conversation

@tony

@tony tony commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

libvcs.pytest_plugin.pytest_ignore_collect returned a concrete False in
its fall-through instead of None. pytest_ignore_collect is a
firstresult=True
hook, so the first implementation to return a non-None value wins and
short-circuits the rest. libvcs's implementation runs first, so its False
silently suppressed every other implementation — gp-libs'
_build skip
and pytest's own
__pycache__/norecursedirs/collect_ignore handling.

The user-visible symptom: after building the docs, the suite aborts during
collection on the generated Sphinx output, whose copied sources have relative
{include} targets that don't resolve from docs/_build/:

ERROR docs/_build/html/history.md - docutils.utils.SystemMessage: Directive "include": file not found: '.../docs/_build/html/../CHANGES'
!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!

Full root-cause writeup in #543.

Fix

Return None (abstain) from every non-matching branch so the firstresult
chain continues to gp-libs and pytest's builtin. The hook still returns True
only to skip tests whose VCS binary is missing. The return annotation widens
to bool | None accordingly.

Testing

  • uv run pytest — 660 passed, 1 skipped; collection no longer aborts with
    stale docs/_build/ output on disk.
  • Three added regression tests in tests/test_pytest_plugin.py cover: abstain
    (None) on a non-VCS path, ignore (True) when a VCS binary is missing, and
    abstain when the binary is present.
  • uv run ruff check and uv run mypy clean.

Closes #543

@tony tony force-pushed the fix/pytest-ignore-collect-firstresult branch from 9c8da0d to bed8828 Compare July 11, 2026 11:19
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.34%. Comparing base (ecd39e4) to head (f7d7c0e).

Files with missing lines Patch % Lines
src/libvcs/pytest_plugin.py 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #544      +/-   ##
==========================================
+ Coverage   61.26%   61.34%   +0.08%     
==========================================
  Files          40       40              
  Lines        6557     6571      +14     
  Branches     1103     1104       +1     
==========================================
+ Hits         4017     4031      +14     
  Misses       1946     1946              
  Partials      594      594              

☔ 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.

tony added 2 commits July 11, 2026 06:22
why: pytest_ignore_collect is a firstresult hook, so the first
non-None return wins and short-circuits the remaining implementations.
The fall-through returned False, silently overriding gp-libs' Sphinx
_build skip and pytest's builtin __pycache__/norecursedirs/collect_ignore
handling — aborting collection on generated docs under docs/_build.

what:
- Return None to abstain on paths with no missing VCS binary
- Widen the return annotation to bool | None

Refs #543
why: Lock in that the firstresult hook abstains with None rather than
voting False, so it no longer suppresses other collection-ignore hooks.

what:
- Abstain (None) on a non-VCS path regardless of installed binaries
- Ignore (True) when a VCS binary is missing
- Abstain (None) when the binary is present

Refs #543
@tony tony force-pushed the fix/pytest-ignore-collect-firstresult branch from bed8828 to 44161ab Compare July 11, 2026 11:22
why: Record the unreleased pytest-plugin fix so downstream users see
it in the next release notes.
@tony tony merged commit 2867e70 into master Jul 11, 2026
7 checks passed
tony added a commit that referenced this pull request Jul 11, 2026
why: Ship the pytest plugin collection-ignore fix, which aborts
collection for downstream suites that build docs before running tests,
plus the runnable-doctest documentation pass.

what:
- Bump version to 0.45.1 in pyproject.toml, __about__.py, and uv.lock
- Date the 0.45.1 CHANGES entry below the 0.46.x unreleased block
- Promote the #544 fix from a bullet to a titled deliverable
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.

pytest_plugin: pytest_ignore_collect returns False, pre-empting other firstresult hooks

1 participant