Skip to content

fix: surface subprocess errors when pytest XML is missing#2141

Merged
KRRT7 merged 1 commit intofix/test-files-silent-dedupfrom
fix/subprocess-xml-errors
May 8, 2026
Merged

fix: surface subprocess errors when pytest XML is missing#2141
KRRT7 merged 1 commit intofix/test-files-silent-dedupfrom
fix/subprocess-xml-errors

Conversation

@KRRT7
Copy link
Copy Markdown
Collaborator

@KRRT7 KRRT7 commented May 7, 2026

Summary

  • Surface subprocess stderr/stdout in the error message when pytest exits non-zero and the JUnit XML file is missing
  • Previously this was a silent failure with no actionable diagnostics

Stack

Part of #2132 linear stack.

Test plan

  • Existing test suite passes

@KRRT7 KRRT7 force-pushed the fix/windows-junitxml-path branch from 38c2445 to 3e83a5c Compare May 7, 2026 17:30
@KRRT7 KRRT7 force-pushed the fix/subprocess-xml-errors branch 2 times, most recently from 184dae6 to a2ddf54 Compare May 7, 2026 17:42
@KRRT7 KRRT7 force-pushed the fix/windows-junitxml-path branch from 3e83a5c to 1728cd4 Compare May 7, 2026 17:42
When the test subprocess exits non-zero and produces no JUnit XML,
log the return code and stdout/stderr at WARNING level so the root
cause is visible in CI logs. Previously this was a generic "No test
results found" message that made Windows CI flakes impossible to
diagnose.

Also fixes pre-existing mypy strict errors in parse_xml.py:
- Add return type to _parse_func
- Type CompletedProcess[str] (subprocess uses text=True)
- Parameterize generic types (tuple, re.Match)
- Remove dead .decode() branches (stdout is already str)
@KRRT7 KRRT7 force-pushed the fix/windows-junitxml-path branch from 1728cd4 to aa98bc1 Compare May 7, 2026 22:47
@KRRT7 KRRT7 force-pushed the fix/subprocess-xml-errors branch from a2ddf54 to 81b0358 Compare May 7, 2026 22:47
@KRRT7 KRRT7 marked this pull request as draft May 7, 2026 22:53
Base automatically changed from fix/windows-junitxml-path to fix/test-files-silent-dedup May 8, 2026 00:09
@KRRT7 KRRT7 marked this pull request as ready for review May 8, 2026 00:11
if not test_xml_file_path.exists():
logger.warning(f"No test results for {test_xml_file_path} found.")
if run_result is not None and run_result.returncode != 0:
stderr_snippet = (run_result.stderr or "")[:500]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 500? why not the entire string?

except AttributeError:
stdout = run_result.stderr
logger.debug(f"Test log - STDOUT : {stdout} \n STDERR : {stderr}")
logger.debug(f"Test log - STDOUT : {run_result.stdout} \n STDERR : {run_result.stderr}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you removed the try except here. are you sure there will be no exceptions?

@KRRT7 KRRT7 merged commit 9c9f0de into fix/test-files-silent-dedup May 8, 2026
42 of 43 checks passed
@KRRT7 KRRT7 deleted the fix/subprocess-xml-errors branch May 8, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants