From 2073f85eaf0526e732857568544654d22c5603a6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 6 May 2026 02:49:53 +0000 Subject: [PATCH] fix(compat): skip writing compat-results.json when no compat tests ran The pytest_sessionfinish hook in tests/claude_code/conftest.py is loaded for every pytest run under tests/claude_code/, including sibling unit- test trees (_driver_unit_tests/, _builder_unit_tests/, ...). Without a guard, those runs wrote an empty results artifact and silently overwrote any real artifact from a prior compat-test run. --- tests/claude_code/conftest.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/claude_code/conftest.py b/tests/claude_code/conftest.py index f58ab3d5897..9baef4e2a30 100644 --- a/tests/claude_code/conftest.py +++ b/tests/claude_code/conftest.py @@ -158,7 +158,16 @@ def pytest_sessionstart(session): def pytest_sessionfinish(session, exitstatus): - """Write the structured results artifact at end of session.""" + """Write the structured results artifact at end of session. + + Skip writing when no compat results were collected — this conftest is + loaded by pytest for every test under `tests/claude_code/`, including + sibling unit-test trees (e.g. `_driver_unit_tests/`). Writing an empty + artifact in those runs would silently overwrite a real artifact from a + prior compat-test run on the same checkout. + """ + if not _COLLECTOR.items: + return artifact_path = os.environ.get(RESULTS_ARTIFACT_ENV) or DEFAULT_ARTIFACT_PATH payload = { "schema_version": "1",