Skip to content

feat: Add pytest error extractor for Python test output#136

Merged
jdutton merged 2 commits intomainfrom
feat/pytest-extractor
Feb 15, 2026
Merged

feat: Add pytest error extractor for Python test output#136
jdutton merged 2 commits intomainfrom
feat/pytest-extractor

Conversation

@jdutton
Copy link
Owner

@jdutton jdutton commented Feb 15, 2026

Summary

  • Adds a new pytest extractor plugin (priority 92) that parses Python pytest output into structured file:line:message errors for LLM consumption
  • Fixes false-positive where the jasmine extractor matched pytest output at 90% confidence, reporting 0 errors despite exit code 1
  • Adds .gitignore patterns for TypeScript compilation artifacts (*.d.ts, *.d.ts.map, *.js.map) that could leak outside dist/

Detection (3 confidence tiers)

  • 95%: platform ... -- Python X.Y.Z, pytest-X.Y.Z header
  • 90%: short test summary info + .py:: test paths
  • 85%: pytest summary format (N passed, N failed) + .py paths

Extraction (3 parsing strategies)

  • FAILURES section: Assertion errors with E prefixed lines and file.py:NN: locations
  • ERRORS section: Collection/import errors with tracebacks (e.g., TypeError: unsupported operand type(s) for |)
  • Short summary fallback: FAILED/ERROR lines when detailed sections absent

Verified against real-world output

Tested against lfa-cc-marketplace where 3 pytest collection errors (Python 3.9 vs 3.10+ str | None syntax) were previously invisible — now correctly extracted with file/line/message.

Test plan

  • 12 tests built via TDD red-green-refactor (5 detection, 4 extraction, 1 metadata, 2 samples)
  • pnpm validate passes (all phases green)
  • Pre-commit hooks pass
  • Verified against real lfa-cc-marketplace pytest output

🤖 Generated with Claude Code

Adds a new pytest extractor plugin that parses Python pytest output into
structured errors with file/line/message. Fixes false-positive where the
jasmine extractor was matching pytest output at 90% confidence and
reporting 0 errors despite exit code 1.

- Detect pytest output at 95/90/85% confidence tiers
- Parse FAILURES section (assertion errors with tracebacks)
- Parse ERRORS section (collection/import errors)
- Fallback to short test summary parsing
- Add `.py::` to jasmine forbidden hints (belt-and-suspenders)
- Add .gitignore patterns for TypeScript compilation artifacts
- 12 tests built via TDD red-green-refactor cycles

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 98.45560% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.79%. Comparing base (97a0583) to head (917d7f8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/extractors/src/extractors/pytest/index.ts 98.39% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   85.57%   85.79%   +0.22%     
==========================================
  Files         114      115       +1     
  Lines       14809    15068     +259     
  Branches     3187     3245      +58     
==========================================
+ Hits        12673    12928     +255     
- Misses       2136     2140       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

@jdutton jdutton merged commit 8c64c63 into main Feb 15, 2026
9 checks passed
@jdutton jdutton deleted the feat/pytest-extractor branch February 15, 2026 17:19
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.

1 participant