pytest filter reports "No tests collected" for runs that executed and passed (false negative summary)
Summary
rtk pytest reports "Pytest: No tests collected" for runs that actually executed and passed tests. Verified today on rtk 0.42.4 (Homebrew, macOS 15, arm64):
$ cd worktree && python -m pytest tests/test_issue_303_attribution.py --co -q
Pytest: No tests collected # rtk-filtered output, exit=0
$ rtk proxy python -m pytest tests/test_issue_303_attribution.py -q
.... [100%] # raw: 4 passed
Full-suite case is worse in terms of trust: 3891 passed / 12 skipped rendered as "No tests collected". This matches the family of #2317 / #2960 / #4178 (benign summary masks the real result) but with the opposite sign โ a successful run is reported as zero tests, so anyone using rtk-filtered pytest output as an acceptance signal draws a false negative conclusion.
Repro
- Any repo whose pytest run exits 0 with collected+passed tests (verified with plain
-qand--co -q). - Run through the rtk pytest filter.
- Output:
Pytest: No tests collected, exit code 0.
Expected
Either pass through the collected/passed counts from the pytest summary line, or emit a neutral "N passed" summary; never report "No tests collected" for a run with a non-empty test count.
wshm ยท Automated triage by AI
๐ Automated Triage
| ๐ Category | bug |
| ๐ Priority | high |
| ๐ฏ Confidence | 90% |
Summary
rtk pytest filter misreports successful, non-empty test runs as 'No tests collected', producing false-negative acceptance signals.
๐ Relevant files
src/pytest/filter.rssrc/pytest/summary.rs
Suggested Actions
- Reproduce with the provided repro (
--co -qand full-suite run) to confirm parser path hit - Check summary-line parsing logic that triggers 'No tests collected' โ likely matches on wrong condition
- Cross-reference PR #2006 (surfacing diagnostic context when no tests collected) for related regression
- Also check #4897 (pytest double-listing failures) since both touch the same summary-parsing code path
Triaged automatically by wshm ยท This is an automated analysis, not a human review.
Thanks for the triage. Adding environment detail for the reproduce step:
- rtk 0.42.4 (Homebrew bottle, macOS 15 arm64, default config, no custom pytest filters)
- Trigger is output-shape dependent, not project dependent: seen on both a single file (
pytest tests/x.py -q, 4 passed) and a full suite (3891 passed / 12 skipped). Both render asPytest: No tests collected. rtk proxy <cmd>bypasses the filter and shows the real counts, so the underlying pytest invocation is fine โ the regression is purely in the summary-line parsing you flagged (src/pytest/summary.rs).- One more data point:
pytest --co -q(collect-only, no executed tests) also renders as "No tests collected", so the parser likely treats "no summary line with counts" and "zero collected" as the same branch.