|
22 | 22 | - test22
|
23 | 23 | """
|
24 | 24 |
|
| 25 | +# Real JUnit report with the 3 tests. One test passed, but there is an error at test teardown. |
| 26 | +# Note that pytest incorrectly reports 4 tests instead of 3. |
| 27 | +# https://github.com/intel/intel-xpu-backend-for-triton/issues/4341. |
| 28 | +JUNIT_XML_REPORT = """\ |
| 29 | +<?xml version="1.0" encoding="utf-8"?> |
| 30 | +<testsuites> |
| 31 | + <testsuite name="pytest" errors="1" failures="0" skipped="2" tests="4" time="31.615" timestamp="2025-05-28T15:26:42.685704+00:00" hostname="example"> |
| 32 | + <testcase classname="python.test.unit.test_perf_warning" name="test_remark_swp_op_before_operands" time="17.602"><error message="xxx"></error></testcase> |
| 33 | + <testcase classname="python.test.unit.test_perf_warning" name="test_mma_remark" time="0.019"><skipped type="pytest.xfail" message="Not designed for XPU" /></testcase> |
| 34 | + <testcase classname="python.test.unit.test_perf_warning" name="test_remark_vectorization" time="0.030"><skipped type="pytest.xfail" message="Not designed for XPU" /></testcase> |
| 35 | + </testsuite> |
| 36 | +</testsuites> |
| 37 | +""" |
| 38 | + |
25 | 39 |
|
26 | 40 | def test_get_warnings_empty_file(tmp_path):
|
27 | 41 | warnings_path = tmp_path / 'suite-warnings.json'
|
@@ -70,3 +84,14 @@ def test_generate_junit_report(tmp_path):
|
70 | 84 | assert stats[0].failed == 1
|
71 | 85 | assert stats[0].skipped == 1
|
72 | 86 | assert stats[0].total == 3
|
| 87 | + |
| 88 | + |
| 89 | +def test_parse_report(tmp_path): |
| 90 | + report_path = tmp_path / 'suite.xml' |
| 91 | + report_path.write_text(JUNIT_XML_REPORT) |
| 92 | + stats = pass_rate.parse_report(report_path) |
| 93 | + assert stats.passed == 0 |
| 94 | + assert stats.xfailed == 2 |
| 95 | + assert stats.failed == 1 |
| 96 | + assert stats.skipped == 0 |
| 97 | + assert stats.total == 3 |
0 commit comments