##// END OF EJS Templates
More concise test summary info
Thomas Kluyver -
Show More
@@ -29,7 +29,7 b' import time'
29
29
30 from .iptest import have, test_group_names, test_sections
30 from .iptest import have, test_group_names, test_sections
31 from IPython.utils.py3compat import bytes_to_str
31 from IPython.utils.py3compat import bytes_to_str
32 from IPython.utils.sysinfo import sys_info
32 from IPython.utils.sysinfo import brief_sys_info
33 from IPython.utils.tempdir import TemporaryDirectory
33 from IPython.utils.tempdir import TemporaryDirectory
34
34
35
35
@@ -206,7 +206,7 b' def do_run(controller):'
206 def report():
206 def report():
207 """Return a string with a summary report of test-related variables."""
207 """Return a string with a summary report of test-related variables."""
208
208
209 out = [ sys_info(), '\n']
209 out = [ brief_sys_info(), '\n']
210
210
211 avail = []
211 avail = []
212 not_avail = []
212 not_avail = []
@@ -327,17 +327,16 b' def run_iptestall(options):'
327 print('_'*70)
327 print('_'*70)
328 print('Test suite completed for system with the following information:')
328 print('Test suite completed for system with the following information:')
329 print(report())
329 print(report())
330 print('Ran %s test groups in %.3fs' % (nrunners, t_tests))
330 took = "Took %.3fs." % t_tests
331 print()
332 print('Status: ', end='')
331 print('Status: ', end='')
333 if not failed:
332 if not failed:
334 print('OK')
333 print('OK.', took)
335 else:
334 else:
336 # If anything went wrong, point out what command to rerun manually to
335 # If anything went wrong, point out what command to rerun manually to
337 # see the actual errors and individual summary
336 # see the actual errors and individual summary
338 failed_sections = [c.section for c in failed]
337 failed_sections = [c.section for c in failed]
339 print('ERROR - {} out of {} test groups failed ({}).'.format(nfail,
338 print('ERROR - {} out of {} test groups failed ({}).'.format(nfail,
340 nrunners, ', '.join(failed_sections)))
339 nrunners, ', '.join(failed_sections)), took)
341 print()
340 print()
342 print('You may wish to rerun these, with:')
341 print('You may wish to rerun these, with:')
343 print(' iptest', *failed_sections)
342 print(' iptest', *failed_sections)
@@ -117,6 +117,34 b' def sys_info():'
117 path = p.dirname(p.abspath(p.join(__file__, '..')))
117 path = p.dirname(p.abspath(p.join(__file__, '..')))
118 return pprint.pformat(pkg_info(path))
118 return pprint.pformat(pkg_info(path))
119
119
120 def _compress_user(path):
121 """Reverse of :func:`os.path.expanduser`
122 """
123 home = os.path.expanduser('~')
124 if path.startswith(home):
125 path = "~" + path[len(home):]
126 return path
127
128 def brief_sys_info():
129 """Return summary information about IPython and the system, as a string.
130 """
131 p = os.path
132 path = p.dirname(p.abspath(p.join(__file__, '..')))
133 inf = pkg_info(path)
134 out = []
135 def _add(name, value):
136 out.append((name, value))
137
138 _add('IPython version', inf['ipython_version'])
139 _add('IPython commit', "{} ({})".format(inf['commit_hash'], inf['commit_source']))
140 _add('IPython package', _compress_user(inf['ipython_path']))
141 _add('Python version', inf['sys_version'].replace('\n',''))
142 _add('sys.executable', _compress_user(inf['sys_executable']))
143 _add('Platform', inf['platform'])
144
145 width = max(len(n) for (n,v) in out)
146 return '\n'.join("{:<{width}}: {}".format(n, v, width=width) for (n,v) in out)
147
120
148
121 def _num_cpus_unix():
149 def _num_cpus_unix():
122 """Return the number of active CPUs on a Unix system."""
150 """Return the number of active CPUs on a Unix system."""
General Comments 0
You need to be logged in to leave comments. Login now