Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions continuous_integration/scripts/parse_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from __future__ import annotations

import html
import re
import sys
from collections import Counter, defaultdict
Expand Down Expand Up @@ -70,6 +71,8 @@ def build_xml(rows: list[tuple[str, str, set[str | None]]]) -> None:
)

for clsname, tname, outcomes in rows:
clsname = html.escape(clsname)
tname = html.escape(tname)
print(f'<testcase classname="{clsname}" name="{tname}" time="0.0"', end="")
if outcomes == {"PASSED"}:
print(" />")
Expand Down
7 changes: 5 additions & 2 deletions distributed/tests/test_parse_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
distributed/tests/test1.py::test_flaky PASSED [ 70%]
distributed/tests/test1.py::test_leaking PASSED [ 72%]
distributed/tests/test1.py::test_leaking LEAKED [ 72%]
distributed/tests/test1.py::test_pass PASSED [ 80%]
distributed/tests/test1.py::test_pass PASSED [ 75%]
distributed/tests/test1.py::test_params[a a] PASSED [ 78%]
distributed/tests/test1.py::test_escape_chars[<lambda>] PASSED [ 80%]
distributed/tests/test1.py::MyTest::test_unittest PASSED [ 86%]
distributed/tests/test1.py::test_timeout
"""
Expand Down Expand Up @@ -57,6 +58,7 @@ def test_parse_rows():
("distributed.tests.test1", "test_leaking", {"PASSED"}),
("distributed.tests.test1", "test_pass", {"PASSED"}),
("distributed.tests.test1", "test_params[a a]", {"PASSED"}),
("distributed.tests.test1", "test_escape_chars[<lambda>]", {"PASSED"}),
("distributed.tests.test1.MyTest", "test_unittest", {"PASSED"}),
("distributed.tests.test1", "test_timeout", {None}),
]
Expand All @@ -74,7 +76,7 @@ def test_build_xml(capsys):
expect = """
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite name="distributed" errors="3" failures="3" skipped="2" tests="14" time="0.0" timestamp="snip" hostname="">
<testsuite name="distributed" errors="3" failures="3" skipped="2" tests="15" time="0.0" timestamp="snip" hostname="">
<testcase classname="distributed.tests.test1" name="test_fail" time="0.0"><failure message=""></failure></testcase>
<testcase classname="distributed.tests.test1" name="test_error_in_setup" time="0.0"><error message="failed on setup"></error></testcase>
<testcase classname="distributed.tests.test1" name="test_pass_and_then_error_in_teardown" time="0.0"><error message="failed on teardown"></error></testcase>
Expand All @@ -86,6 +88,7 @@ def test_build_xml(capsys):
<testcase classname="distributed.tests.test1" name="test_leaking" time="0.0" />
<testcase classname="distributed.tests.test1" name="test_pass" time="0.0" />
<testcase classname="distributed.tests.test1" name="test_params[a a]" time="0.0" />
<testcase classname="distributed.tests.test1" name="test_escape_chars[&lt;lambda&gt;]" time="0.0" />
<testcase classname="distributed.tests.test1.MyTest" name="test_unittest" time="0.0" />
<testcase classname="distributed.tests.test1" name="test_timeout" time="0.0"><failure message="pytest-timeout exceeded"></failure></testcase>
</testsuite>
Expand Down