From a1bf9487311a95708bf1b13cc79537cdd9f00fbe Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 15 Sep 2026 22:39:32 -0700 Subject: [PATCH] test: assert integration collection by summary, not exit code --- .../test_integration_suite_imports.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/code_coverage_tests/test_integration_suite_imports.py b/tests/code_coverage_tests/test_integration_suite_imports.py index ed299e7ce5a..9cf2c9be394 100644 --- a/tests/code_coverage_tests/test_integration_suite_imports.py +++ b/tests/code_coverage_tests/test_integration_suite_imports.py @@ -31,9 +31,14 @@ def _collect_without_injected_pythonpath(target: str) -> subprocess.CompletedPro def _assert_collected(result: subprocess.CompletedProcess[str], target: str) -> None: - assert result.returncode == 0, f"{target} exited {result.returncode}\n{result.stdout}\n{result.stderr}" + # The exit code cannot carry this: tests/integration/conftest.py raises a UsageError + # under GITHUB_ACTIONS to keep these contracts owned by CircleCI, so a healthy + # collection and a failed import both exit 4. Only the summary line separates them. match: Final = COLLECTED_COUNT.search(result.stdout) - assert match is not None, f"{target} reported no collection summary\n{result.stdout}" + assert match is not None, ( + f"{target} never reached a collection summary, so its imports did not resolve\n" + f"{result.stdout}\n{result.stderr}" + ) assert int(match.group(1)) > 0, f"{target} collected nothing, so nothing was verified\n{result.stdout}"