fix: clarify Python pytest failure messages - #24
Conversation
Keep custom assertion messages intact and retain default pytest diagnostics for failed Python tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the upstream Python error-handling contract while retaining detailed pytest failure diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Improves Python pytest result parsing so learners receive more constructive, non-truncated failure feedback (custom assertion messages and full E ... diagnostic lines), aligning with Issue #23’s request for clearer outcome messaging.
Changes:
- Reworked
parsePytestOutputto extract per-failure error message blocks (including multiline assertion details) and distinguish failures vs errors for counting. - Added dependency-free Node regression tests covering custom assertion messages, default assertion diffs, exceptions, multiple failures, collection errors, and mixed failure/error runs.
- Updated
npm testto run the new regression suite.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| executor.js | Updates pytest output parsing to preserve detailed assertion/exception diagnostics and count errors alongside failures. |
| test/executor.test.js | Adds Node-based regression tests for pytest parsing behavior across failure/error scenarios. |
| package.json | Wires npm test to run the new regression tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ensure production requests complete assertion diagnostics through a tested invocation contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise real verbose pytest output and preserve response-state behavior across success, failures, collection errors, no tests, and process failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
test/pytest-integration.test.js:12
npm testnow runstest:integration, which unconditionally spawns thepytestbinary. Ifpytestis not installed / not on PATH (common outside the Docker image),spawnSyncwill return an error and this test will fail (or produce confusing assertions) even though the Node code is fine. Consider skipping this integration regression whenpytestis unavailable, or failing with an explicit message.
const versionResult = spawnSync('pytest', ['--version'], { encoding: 'utf8' });
const pytestVersion = (versionResult.stdout || versionResult.stderr).trim();
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Follow-up plan: preserve multiline failure formatting in codewit.usPR #24 correctly returns the complete
Acceptance criteria
This should be implemented as a small follow-up PR in |
Closes #23
Summary
Testing