Repository navigation
Description
What happens
When the registry, the trace, or a test's covers(...) declaration is malformed, testgraph can crash with a traceback and exit 1. Exit 1 is the code for "tests failed", so CI reads a malformed input as a red test. In one case (the adapter, below) the crash comes only after the whole suite has run.
testgraph should refuse these inputs up front with exit 2 and a message that names the input at fault.
The final review of #168 found these items. Most behave the same on the commit before #168; the ones that don't are marked.
Checklist (main at fc3d000)
- A failing test that declares a non-string journey id crashes
verify. For example, a failing test with@covers("J1", 1), or a class-levelcovers(1)combined with a method-levelcovers("J1"). The result isAttributeError: 'int' object has no attribute 'rstrip'injourney_sort_key, reached from verify.py#L226, with exit 1. Main behaves the same way (verified by a reviewer). fix: one traced-run path for verify and the adapter; crash-safe trace writes #168 had briefly turned this into a refusal, and then relaxed the check so thatcovers(1)alone is not refused. Expected: validate the id and either drop it or report it asunvalidatedwithout crediting it. - One unhashable id anywhere refuses the whole
verifyrun. A deselected@covers(["J2"])makespayload_shape_errorrefuse a run whose selected tests are fine, and the message blames "the trace file". Changed by fix: one traced-run path for verify and the adapter; crash-safe trace writes #168: before it, this case gave exit 0. Expected: name the test and its decorator, and refuse only when an affected test is selected. - A non-object JSON file in a journeys directory breaks registry auto-resolution for every repo.
resolve_for_repocallsjson.load(f).get("target")(L126) and catches only OSError and ValueError, so a stray[]raises AttributeError. Expected: load throughregistry.loadinside the try, and skip that file. - The
selectandexportCLIs don't catchregistry.load's ValueError. A non-object registry gives a traceback with exit 1 at select.py#L353 and export.py#L364. The pre-push hook depends onselect. Expected: a refusal with exit 2. - A registry that is an object but malformed (
{},{"journeys": []},{"journeys": "x"}) makespytest_adapterrun the whole suite and then crash injourney_entrieswith KeyError or AttributeError, exit 1.verifycrashes before the run. Expected: check the registry's shape at load time. - A path like
symlink/..resolves differently from the kernel. Withlink -> else/sub,--trace-out link/../t.jsonwrites./t.json, but the shell writeselse/t.json. This happens inwrite_json_atomicand in tgtrace's_write, becauseabspathresolves..without following the link. Expected: takerealpathof the directory, then join the file name. - Wording: tgtrace and
harness/trace.pycall a directory target a stream. They refuse a directory-shaped target with the "streams and devices" message (tgtrace.py#L210). The adapter already says "is a directory". - Tidy: the check for a path that names a directory appears three times. Use one helper in
pytest_adapter; tgtrace keeps its own copy by design.
Related: test_pre_push fails intermittently under load
_stray_processes scans all of /proc for its marker process (sleep 31337). When other sessions on the same host run the suite at the same time, they trip it, and 1 to 3 of the hung-hook tests fail. Run alone, the file passed 3 of 3 times on main and on #168's branch (verified by a reviewer). Expected: scope the scan to the test's own process group.
Related: #154, #168 (the review rounds that found these). Not #159, which is about Playwright flake policy.
Activity