What happens
Two distinct, unreported triggers make rtk pytest report Pytest: No tests collected (and silently discard the collected FAILURES section) for runs that actually executed tests — including failing ones. Both reproduced on rtk 0.43.0 and present in develop (5d32d07: the -q injection in pytest_cmd.rs::run and the zero-count early return in build_pytest_summary).
For an agent that reads the filtered text, this is a false green: a failing test run comes back looking like an empty one.
Trigger 1 — the injected -q doubles up with the project's addopts = -q
rtk pytest unconditionally appends -q when the CLI args don't contain it. It cannot see the project's pytest config; with this textbook pytest.ini:
every run is effectively -qq — a verbosity level at which pytest prints no final summary line at all. No summary line → all counts parse to zero → "No tests collected", and the early return drops the FAILURES that the state machine had already collected.
$ rtk pytest tests/test_contracts.py # 20 passing tests, addopts = -q
Pytest: No tests collected
$ echo $?
0
Same command through rtk proxy: 20 passed, 1 warning in 0.04s.
With a file containing 2 real failing tests, the filtered run still prints Pytest: No tests collected and exits 0.
Trigger 2 — ANSI-colored summaries defeat the count parser
parse_summary_line does words[i-1].parse::<usize>() on raw text. Under FORCE_COLOR / PY_COLORS / CI, pytest wraps the counts in escapes, and \x1b[32m30 is not a number:
$ printf '\x1b[32m30 passed\x1b[0m\x1b[33m, 1 warning\x1b[0m\x1b[32m in 0.11s\x1b[0m' # fixture
→ Pytest: No tests collected
Worse, on a mixed line the failure count alone is dropped (its 1 carries the color prefix; passed's survives after the comma split):
$ printf '\x1b[31m1 failed\x1b[0m\x1b[32m, 1 passed\x1b[0m\x1b[31m in 0.05s\x1b[0m' # fixture
→ Pytest: 1 passed # the failure is gone from the summary
Relationship to existing work
PR incoming with a fix + regression tests for both triggers.
What happens
Two distinct, unreported triggers make
rtk pytestreportPytest: No tests collected(and silently discard the collected FAILURES section) for runs that actually executed tests — including failing ones. Both reproduced on rtk 0.43.0 and present indevelop(5d32d07: the-qinjection inpytest_cmd.rs::runand the zero-count early return inbuild_pytest_summary).For an agent that reads the filtered text, this is a false green: a failing test run comes back looking like an empty one.
Trigger 1 — the injected
-qdoubles up with the project'saddopts = -qrtk pytestunconditionally appends-qwhen the CLI args don't contain it. It cannot see the project's pytest config; with this textbookpytest.ini:every run is effectively
-qq— a verbosity level at which pytest prints no final summary line at all. No summary line → all counts parse to zero →"No tests collected", and the early return drops the FAILURES that the state machine had already collected.Same command through
rtk proxy:20 passed, 1 warning in 0.04s.With a file containing 2 real failing tests, the filtered run still prints
Pytest: No tests collectedand exits 0.Trigger 2 — ANSI-colored summaries defeat the count parser
parse_summary_linedoeswords[i-1].parse::<usize>()on raw text. UnderFORCE_COLOR/PY_COLORS/ CI, pytest wraps the counts in escapes, and\x1b[32m30is not a number:Worse, on a mixed line the failure count alone is dropped (its
1carries the color prefix;passed's survives after the comma split):Relationship to existing work
rtk pytest -qincorrectly reports "Pytest: No tests collected" when tests are actually executed #565 (closed) fixed the bare quiet summary line variant — both triggers above bypass that fix (there is no summary line at all / the line is colored).PR incoming with a fix + regression tests for both triggers.