mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-119050: Add XML support to libregrtest refleak checker (#119148)
regrtest test runner: Add XML support to the refleak checker (-R option). * run_unittest() now stores XML elements as string, rather than objects, in support.junit_xml_list. * runtest_refleak() now saves/restores XML strings before/after checking for reference leaks. Save XML into a temporary file.
This commit is contained in:
parent
bf17986096
commit
9257731f5d
5 changed files with 39 additions and 25 deletions
|
@ -57,7 +57,10 @@ def _run_suite(suite):
|
|||
result = runner.run(suite)
|
||||
|
||||
if support.junit_xml_list is not None:
|
||||
support.junit_xml_list.append(result.get_xml_element())
|
||||
import xml.etree.ElementTree as ET
|
||||
xml_elem = result.get_xml_element()
|
||||
xml_str = ET.tostring(xml_elem).decode('ascii')
|
||||
support.junit_xml_list.append(xml_str)
|
||||
|
||||
if not result.testsRun and not result.skipped and not result.errors:
|
||||
raise support.TestDidNotRun
|
||||
|
@ -280,9 +283,7 @@ def _runtest(result: TestResult, runtests: RunTests) -> None:
|
|||
|
||||
xml_list = support.junit_xml_list
|
||||
if xml_list:
|
||||
import xml.etree.ElementTree as ET
|
||||
result.xml_data = [ET.tostring(x).decode('us-ascii')
|
||||
for x in xml_list]
|
||||
result.xml_data = xml_list
|
||||
finally:
|
||||
if use_timeout:
|
||||
faulthandler.cancel_dump_traceback_later()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue