Skip to content

fix(pytest): surface collection errors - #3047

Closed
houtinghang wants to merge 1 commit into
rtk-ai:developfrom
houtinghang:codex/fix-pytest-collection-error-summary
Closed

houtinghang wants to merge 1 commit into
rtk-ai:developfrom
houtinghang:codex/fix-pytest-collection-error-summary

Conversation

@houtinghang

Copy link
Copy Markdown

Fixes #3032

What changed

  • Parse pytest ERRORS sections and singular/plural error counts.
  • Preserve the first collection-error module and useful traceback lines.
  • Distinguish collection failures from a genuine zero-test run.
  • Add a regression fixture covering an import failure during collection.

Root cause

The pytest filter only recognized pass/fail/skip summaries and FAILURES sections. A collection failure reports an ERRORS section and an error count, so the parsed counts remained zero and the filter fell through to Pytest: No tests collected.

User impact

Before:

Pytest: No tests collected

After, using the regression fixture through the real rtk pipe --filter pytest binary:

Pytest: 1 error during collection

Collection errors:
1. [ERROR] tests/test_x.py
     ImportError while importing test module 'C:\workspace\example\tests\test_x.py'.
     C:\Python313\Lib\importlib\__init__.py:88: in import_module
     tests\test_x.py:1: in <module>

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings - 0 warnings
  • Focused pytest parser tests - 10 passed
  • cargo test --all - 2434 unit tests and 11 integration tests passed; 0 failed; 8 ignored

@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot

Copy link
Copy Markdown
Contributor

Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you!

@rtk-release-bot rtk-release-bot Bot closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk pytest shows "No tests collected" for a collection error (exit 2), masking the ImportError/traceback

1 participant