Skip to content

pytest filter reports "No tests collected" for runs that executed and passed (false negative summary) #5016

Closed

Description

@dahai80

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

  1. Any repo whose pytest run exits 0 with collected+passed tests (verified with plain -q and --co -q).
  2. Run through the rtk pytest filter.
  3. 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.

Activity

  1. rtk-wshm-sync-bot commented on Nov 5, 2026

    @rtk-wshm-sync-bot

    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.rs
    • src/pytest/summary.rs

    Suggested Actions

    1. Reproduce with the provided repro (--co -q and full-suite run) to confirm parser path hit
    2. Check summary-line parsing logic that triggers 'No tests collected' — likely matches on wrong condition
    3. Cross-reference PR fix(pytest): surface diagnostic context when no tests are collected #2006 (surfacing diagnostic context when no tests collected) for related regression
    4. Also check rtk pytest / pipe -f pytest list each failing test twice (FAILURES block and short summary line) #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.

  2. dahai80 commented on Nov 5, 2026

    @dahai80
    Author

    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 as Pytest: 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions