You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk pytest shows "No tests collected" for a collection error (exit 2), masking the ImportError/traceback #3032
rtk pytest renders a pytest collection error (exit code 2) using the "No tests collected" summary (pytest's exit-code-5 wording), hiding the
traceback and the real cause. A red TDD state — e.g. a test module that fails
to import a not-yet-created symbol — reads as "nothing ran" instead of the
actual ImportError. This also surfaces through the Claude Code hook, which
rewrites python -m pytest ... → rtk pytest ....
The exit code itself is correct (2), so scripts checking $? are safe — but an
agent or human reading the summary is misled about why the run failed.
Environment
rtk 0.43.0 (latest release)
Windows 11, Python 3.14, git-bash
Repro
A test module with a bad import (collection error, not a test failure):
# tests/test_x.pyfrommypkgimportDoesNotExistYet# ImportError at collectiondeftest_ok():
assertTrue
$ rtk proxy python -m pytest tests/test_x.py -q...E ImportError: cannot import name 'DoesNotExistYet' from 'mypkg'=========================== short test summary info ===========================ERROR tests/test_x.py!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!1 error in 0.39s
Expected
Distinguish a collection error (exit 2 — errors during collection) from a
genuine no tests collected (exit 5). For the exit-2 case, surface the error
count and at least the first error line / failing module, e.g.:
Pytest: 1 error during collection — tests/test_x.py: ImportError: cannot import name 'DoesNotExistYet'
so the summary points at the real cause instead of the misleading "No tests
collected".
Workaround
exclude_commands = ["python"] under [hooks] in config.toml (rtk reduces python -m pytest to base command python, so ["pytest"] does not match),
or rtk proxy python -m pytest ... for full output.
rtk pytest's collection-error (exit 2) path reuses the 'No tests collected' (exit 5) summary, hiding the ImportError/traceback; should detect exit-2 collection errors and surface the error count plus first failing module/line.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
Triaged automatically by wshm · This is an automated analysis, not a human review.
Similar issue: Claude models are often confused when "No tests collected" is returned by RTK - they go on a treasure-hunt finding the root cause for this one.
Fable's own conclusion: summarizing empty output as "No tests collected" is a fabricated conclusion. Silence should stay silent. This is the part that actually costs time, and a memory note won't fix it for anyone else.
This is fixed on develop. Running the repro (a test module whose import fails) with rtk pytest tests/test_x.py -q now prints the full collection ERRORS block, including the ImportError traceback and Interrupted: 1 error during collection, and still exits 2 — the misleading 'No tests collected' summary is no longer used for exit-2 collection errors. Closing; please reopen or comment if you still see it on the latest version.
Activity
pszymkowiak commentedon Jul 17, 2026
🔍 Automated Triage
bugmediumSummary
rtk pytest's collection-error (exit 2) path reuses the 'No tests collected' (exit 5) summary, hiding the ImportError/traceback; should detect exit-2 collection errors and surface the error count plus first failing module/line.
Triaged automatically by wshm · This is an automated analysis, not a human review.
vanhumbeecka commentedon Jul 17, 2026
Similar issue: Claude models are often confused when "No tests collected" is returned by RTK - they go on a treasure-hunt finding the root cause for this one.
Fable's own conclusion:
summarizing empty output as "No tests collected" is a fabricated conclusion. Silence should stay silent. This is the part that actually costs time, and a memory note won't fix it for anyone else.KuSh commentedon Sep 5, 2026
This is fixed on develop. Running the repro (a test module whose import fails) with
rtk pytest tests/test_x.py -qnow prints the full collection ERRORS block, including the ImportError traceback andInterrupted: 1 error during collection, and still exits 2 — the misleading 'No tests collected' summary is no longer used for exit-2 collection errors. Closing; please reopen or comment if you still see it on the latest version.