summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-01-17 16:36:04 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2018-01-17 16:36:04 (GMT)
commit4e09c0c8589f9152646f2cf403136dc783bcea4c (patch)
tree8d3fea0fd988b1db261f116d8842b3ed83be1fa0 /Lib/test
parentc2740e8a263e76427a8102a89f4b491a3089b2a1 (diff)
downloadcpython-4e09c0c8589f9152646f2cf403136dc783bcea4c.zip
cpython-4e09c0c8589f9152646f2cf403136dc783bcea4c.tar.gz
cpython-4e09c0c8589f9152646f2cf403136dc783bcea4c.tar.bz2
pythoninfo: add time.time and datetime.datetime.now (GH-5214) (#5219)
(cherry picked from commit 7d91c0250408e202243c77c1dc9afdb321b6b32f)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/pythoninfo.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index 9ca26c9..f1b0233 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -315,6 +315,8 @@ def collect_tkinter(info_add):
def collect_time(info_add):
import time
+ info_add('time.time', time.time())
+
attributes = (
'altzone',
'daylight',
@@ -326,7 +328,16 @@ def collect_time(info_add):
if hasattr(time, 'get_clock_info'):
for clock in ('time', 'perf_counter'):
tinfo = time.get_clock_info(clock)
- info_add('time.%s' % clock, tinfo)
+ info_add('time.get_clock_info(%s)' % clock, tinfo)
+
+
+def collect_datetime(info_add):
+ try:
+ import datetime
+ except ImportError:
+ return
+
+ info_add('datetime.datetime.now', datetime.datetime.now())
def collect_sysconfig(info_add):
@@ -497,6 +508,7 @@ def collect_info(info):
collect_sys,
collect_sysconfig,
collect_time,
+ collect_datetime,
collect_tkinter,
collect_zlib,
collect_expat,