summaryrefslogtreecommitdiffstats
path: root/Lib/pprint.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-12-17 10:30:34 (GMT)
committerGitHub <noreply@github.com>2018-12-17 10:30:34 (GMT)
commit8db5b54463118e5eb60cb3582e3108623f01f5df (patch)
treebacd30bf9a8b946798ae30abf8c764d2c6f47d8d /Lib/pprint.py
parent2cf4c202ffeb30787c944365ba54013688b854c2 (diff)
downloadcpython-8db5b54463118e5eb60cb3582e3108623f01f5df.zip
cpython-8db5b54463118e5eb60cb3582e3108623f01f5df.tar.gz
cpython-8db5b54463118e5eb60cb3582e3108623f01f5df.tar.bz2
bpo-35513, unittest: TextTestRunner uses time.perf_counter() (GH-11180)
TextTestRunner of unittest.runner now uses time.perf_counter() rather than time.time() to measure the execution time of a test: time.time() can go backwards, whereas time.perf_counter() is monotonic. Similar change made in libregrtest, pprint and random.
Diffstat (limited to 'Lib/pprint.py')
-rw-r--r--Lib/pprint.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/pprint.py b/Lib/pprint.py
index bcf2eed..f2a1178 100644
--- a/Lib/pprint.py
+++ b/Lib/pprint.py
@@ -568,11 +568,11 @@ def _perfcheck(object=None):
if object is None:
object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
p = PrettyPrinter()
- t1 = time.time()
+ t1 = time.perf_counter()
_safe_repr(object, {}, None, 0)
- t2 = time.time()
+ t2 = time.perf_counter()
p.pformat(object)
- t3 = time.time()
+ t3 = time.perf_counter()
print("_safe_repr:", t2 - t1)
print("pformat:", t3 - t2)