bpo-41718: Disable support.testresult XML output by default (GH-24982)
RegressionTestResult.USE_XML must now be set to True to get the JUnit
XML output.
Reduce the number of imports when --junit-xml=FILE option is not
used: 153 => 144 (-9).
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
index 7738d4f..715d4b9 100644
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -93,6 +93,10 @@ def _test_audit_hook(name, args):
support.SHORT_TIMEOUT = min(support.SHORT_TIMEOUT, ns.timeout)
support.LONG_TIMEOUT = min(support.LONG_TIMEOUT, ns.timeout)
+ if ns.xmlpath:
+ from test.support.testresult import RegressionTestResult
+ RegressionTestResult.USE_XML = True
+
def replace_stdout():
"""Set stdout encoder error handler to backslashreplace (as stderr error