test_wiki_junit_robust.py¶
tests/test_wiki_junit_robust.py
A JUnit report that is not valid XML is recovered or refused by name (#72 bug 3, 2.1).
test_an_unreadable_report_is_refused_naming_file_and_line
None test_wiki_junit_robust.test_an_unreadable_report_is_refused_naming_file_and_line(Path tmp_path)
Never a raw ParseError: a ValueError with the file, line and column.
tests/test_wiki_junit_robust.py:38
Checks
assert "broken.xml" in text and "line" in text
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-002 | measured | test_an_unreadable_report_is_refused_naming_file_and_line → parse_junit |
| REQ-DDB-WIKI-010 | measured | test_an_unreadable_report_is_refused_naming_file_and_line → parse_junit → fold_cases |
Source · 8 lines
def test_an_unreadable_report_is_refused_naming_file_and_line(tmp_path: Path) -> None:
"""@brief Never a raw ParseError: a ValueError with the file, line and column."""
report = tmp_path / "broken.xml"
report.write_text('<testsuite>\n<testcase name="a">\n')
with pytest.raises(ValueError) as exc:
parse_junit([report])
text = str(exc.value)
assert "broken.xml" in text and "line" in text1 more lines, not shown
Activity · 6 steps
test_terminal_colour_codes_in_a_report_are_stripped_and_said
None test_wiki_junit_robust.test_terminal_colour_codes_in_a_report_are_stripped_and_said(Path tmp_path, caplog)
ANSI sequences and XML-illegal controls are removed, the count logged, results kept.
tests/test_wiki_junit_robust.py:28
Checks
assert results["test_a"].status == "passed" and results["test_b"].status == "failed"assert "ceedling.xml" in caplog.text and "control" in caplog.text
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-WIKI-002 | measured | test_terminal_colour_codes_in_a_report_are_stripped_and_said → parse_junit |
| REQ-DDB-WIKI-010 | measured | test_terminal_colour_codes_in_a_report_are_stripped_and_said → parse_junit → fold_cases |
Source · 10 lines
def test_terminal_colour_codes_in_a_report_are_stripped_and_said(tmp_path: Path, caplog) -> None: # noqa: ANN001
"""@brief ANSI sequences and XML-illegal controls are removed, the count logged, results kept."""
report = tmp_path / "ceedling.xml"
report.write_bytes(_COLOURED.encode("utf-8"))
with caplog.at_level(logging.WARNING):
results = parse_junit([report])
assert results["test_a"].status == "passed" and results["test_b"].status == "failed"
assert "ceedling.xml" in caplog.text and "control" in caplog.text