##// END OF EJS Templates
time magic: shorten unnecessary output on windows...
Jan Schulz -
Show More
@@ -948,8 +948,10 b' python-profiler package from non-free.""")'
948 cpu_user = end[0]-st[0]
948 cpu_user = end[0]-st[0]
949 cpu_sys = end[1]-st[1]
949 cpu_sys = end[1]-st[1]
950 cpu_tot = cpu_user+cpu_sys
950 cpu_tot = cpu_user+cpu_sys
951 print "CPU times: user %s, sys: %s, total: %s" % \
951 # On windows cpu_sys is always zero, so no new information to the next print
952 (_format_time(cpu_user),_format_time(cpu_sys),_format_time(cpu_tot))
952 if sys.platform != 'win32':
953 print "CPU times: user %s, sys: %s, total: %s" % \
954 (_format_time(cpu_user),_format_time(cpu_sys),_format_time(cpu_tot))
953 print "Wall time: %s" % _format_time(wall_time)
955 print "Wall time: %s" % _format_time(wall_time)
954 if tc > tc_min:
956 if tc > tc_min:
955 print "Compiler : %s" % _format_time(tc)
957 print "Compiler : %s" % _format_time(tc)
@@ -283,16 +283,24 b' def test_tb_syntaxerror():'
283 def test_time():
283 def test_time():
284 ip = get_ipython()
284 ip = get_ipython()
285
285
286 with tt.AssertPrints("CPU times: user "):
286 with tt.AssertPrints("Wall time: "):
287 ip.run_cell("%time None")
287 ip.run_cell("%time None")
288
288
289 ip.run_cell("def f(kmjy):\n"
289 ip.run_cell("def f(kmjy):\n"
290 " %time print (2*kmjy)")
290 " %time print (2*kmjy)")
291
291
292 with tt.AssertPrints("CPU times: user "):
292 with tt.AssertPrints("Wall time: "):
293 with tt.AssertPrints("hihi", suppress=False):
293 with tt.AssertPrints("hihi", suppress=False):
294 ip.run_cell("f('hi')")
294 ip.run_cell("f('hi')")
295
295
296
297 @dec.skip_win32
298 def test_time2():
299 ip = get_ipython()
300
301 with tt.AssertPrints("CPU times: user "):
302 ip.run_cell("%time None")
303
296 def test_doctest_mode():
304 def test_doctest_mode():
297 "Toggle doctest_mode twice, it should be a no-op and run without error"
305 "Toggle doctest_mode twice, it should be a no-op and run without error"
298 _ip.magic('doctest_mode')
306 _ip.magic('doctest_mode')
General Comments 0
You need to be logged in to leave comments. Login now