summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-23 00:40:31 (GMT)
committerGitHub <noreply@github.com>2021-03-23 00:40:31 (GMT)
commit9feae41c4f04ca27fd2c865807a5caeb50bf4fc4 (patch)
treefbc3f75717ab19ca03643b86549f38c42fcff48e /Lib/test/support
parent30793e81bd90f3346e962435d49073bc588f067c (diff)
downloadcpython-9feae41c4f04ca27fd2c865807a5caeb50bf4fc4.zip
cpython-9feae41c4f04ca27fd2c865807a5caeb50bf4fc4.tar.gz
cpython-9feae41c4f04ca27fd2c865807a5caeb50bf4fc4.tar.bz2
bpo-41718: libregrtest avoids importing datetime (GH-24985)
* libregrtest reimplements datetime.timedelta.__str__() * support.testresult only imports datetime if USE_XML is true.
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/testresult.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/test/support/testresult.py b/Lib/test/support/testresult.py
index 6be3e52..670afbe 100644
--- a/Lib/test/support/testresult.py
+++ b/Lib/test/support/testresult.py
@@ -9,8 +9,6 @@ import time
import traceback
import unittest
-from datetime import datetime
-
class RegressionTestResult(unittest.TextTestResult):
separator1 = '=' * 70 + '\n'
separator2 = '-' * 70 + '\n'
@@ -21,6 +19,7 @@ class RegressionTestResult(unittest.TextTestResult):
self.buffer = True
if self.USE_XML:
from xml.etree import ElementTree as ET
+ from datetime import datetime
self.__ET = ET
self.__suite = ET.Element('testsuite')
self.__suite.set('start', datetime.utcnow().isoformat(' '))