Handle JUnit <error> result state in parse_testcase()#134
Merged
Conversation
87a359d to
0b350c8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #134 +/- ##
==========================================
+ Coverage 85.60% 85.84% +0.24%
==========================================
Files 28 28
Lines 1639 1667 +28
Branches 176 177 +1
==========================================
+ Hits 1403 1431 +28
Misses 158 158
Partials 78 78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0b350c8 to
20764c0
Compare
ubmarco
approved these changes
Jun 8, 2026
Previously, test cases with an <error> element were silently classified as "passed" because the if/elif/else chain only checked for <skipped> and <failure>. This is a false-positive verdict — errors indicate unexpected exceptions or infrastructure crashes, not passing tests. - Add explicit handling for the <error> element in parse_testcase() - Add CSS styling for the tr_error result type (orange) - Also fix potential None in failure text (use `or ""` guard) - Add test fixture and test case for error state parsing Closes #132
1690429 to
cb10c95
Compare
Merged
ubmarco
added a commit
that referenced
this pull request
Jun 16, 2026
## Release v1.4.0 Bumps the version (`pyproject.toml`, `docs/conf.py`, `test_reports.py`) and adds the 1.4.0 changelog for everything merged since 1.3.2. **Highlights** - Feature (#135): map JUnit XML `<properties>` to Sphinx-Needs fields/links. - Sphinx-Needs 8 support (#133): fields registered via the new `add_field` API. - Bugfix (#133): `file`, `suite`, `case`, `case_name`, `case_parameter` and `classname` are now registered with a typed schema → default to `None` → stripped before schema validation, fixing false-positive `Unevaluated properties are not allowed` warnings under `unevaluatedProperties: false`. Released 1.3.2 registered them untyped (default `""`), which leaked. - Bugfix (#134): JUnit `<error>` test cases were misclassified as `passed`; now handled correctly in `parse_testcase()`. - Testing (#130, #137): run against Sphinx-Needs 6.3.0; regression test that a strict schema ignores unpopulated Sphinx-Test-Reports fields. - Docs (#136, #139): clarify Sphinx-Needs type names vs. the hyphenated directives; note that numeric `cases` filtering requires Sphinx-Needs >= 6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #132
parse_testcase()now explicitly handles the JUnit<error>element, which represents unexpected exceptions or infrastructure crashes<error>test cases were silently classified as"passed"(false-positive verdict)tr_errorresult type (orange, distinct from failure red and skip gray)Nonetext in<failure>elements (consistency with the<skipped>branch)Changes
sphinxcontrib/test_reports/junitparser.py— Addelif hasattr(testcase, "error")branch before theelseclausesphinxcontrib/test_reports/css/common.css— Addtr_errorrow and status badge stylestests/doc_test/utils/xml_data_error.xml— New test fixture with all four result statestests/test_junit_parser.py— Newtest_parse_error_xml()covering error parsingTest plan
test_parse_error_xmlverifies error result, type, message, and text extraction"tr_" + resultpattern handles the new state automatically