Show More
@@ -29,8 +29,9 b' import subprocess' | |||||
29 | import time |
|
29 | import time | |
30 |
|
30 | |||
31 | from .iptest import have, test_group_names as py_test_group_names, test_sections |
|
31 | from .iptest import have, test_group_names as py_test_group_names, test_sections | |
|
32 | from IPython.utils.path import compress_user | |||
32 | from IPython.utils.py3compat import bytes_to_str |
|
33 | from IPython.utils.py3compat import bytes_to_str | |
33 | from IPython.utils.sysinfo import sys_info |
|
34 | from IPython.utils.sysinfo import get_sys_info | |
34 | from IPython.utils.tempdir import TemporaryDirectory |
|
35 | from IPython.utils.tempdir import TemporaryDirectory | |
35 |
|
36 | |||
36 |
|
37 | |||
@@ -270,8 +271,20 b' def do_run(controller):' | |||||
270 |
|
271 | |||
271 | def report(): |
|
272 | def report(): | |
272 | """Return a string with a summary report of test-related variables.""" |
|
273 | """Return a string with a summary report of test-related variables.""" | |
|
274 | inf = get_sys_info() | |||
|
275 | out = [] | |||
|
276 | def _add(name, value): | |||
|
277 | out.append((name, value)) | |||
273 |
|
278 | |||
274 | out = [ sys_info(), '\n'] |
|
279 | _add('IPython version', inf['ipython_version']) | |
|
280 | _add('IPython commit', "{} ({})".format(inf['commit_hash'], inf['commit_source'])) | |||
|
281 | _add('IPython package', compress_user(inf['ipython_path'])) | |||
|
282 | _add('Python version', inf['sys_version'].replace('\n','')) | |||
|
283 | _add('sys.executable', compress_user(inf['sys_executable'])) | |||
|
284 | _add('Platform', inf['platform']) | |||
|
285 | ||||
|
286 | width = max(len(n) for (n,v) in out) | |||
|
287 | out = ["{:<{width}}: {}\n".format(n, v, width=width) for (n,v) in out] | |||
275 |
|
288 | |||
276 | avail = [] |
|
289 | avail = [] | |
277 | not_avail = [] |
|
290 | not_avail = [] | |
@@ -385,17 +398,16 b' def run_iptestall(options):' | |||||
385 | print('_'*70) |
|
398 | print('_'*70) | |
386 | print('Test suite completed for system with the following information:') |
|
399 | print('Test suite completed for system with the following information:') | |
387 | print(report()) |
|
400 | print(report()) | |
388 | print('Ran %s test groups in %.3fs' % (nrunners, t_tests)) |
|
401 | took = "Took %.3fs." % t_tests | |
389 | print() |
|
|||
390 | print('Status: ', end='') |
|
402 | print('Status: ', end='') | |
391 | if not failed: |
|
403 | if not failed: | |
392 | print('OK') |
|
404 | print('OK (%d test groups).' % nrunners, took) | |
393 | else: |
|
405 | else: | |
394 | # If anything went wrong, point out what command to rerun manually to |
|
406 | # If anything went wrong, point out what command to rerun manually to | |
395 | # see the actual errors and individual summary |
|
407 | # see the actual errors and individual summary | |
396 | failed_sections = [c.section for c in failed] |
|
408 | failed_sections = [c.section for c in failed] | |
397 | print('ERROR - {} out of {} test groups failed ({}).'.format(nfail, |
|
409 | print('ERROR - {} out of {} test groups failed ({}).'.format(nfail, | |
398 | nrunners, ', '.join(failed_sections))) |
|
410 | nrunners, ', '.join(failed_sections)), took) | |
399 | print() |
|
411 | print() | |
400 | print('You may wish to rerun these, with:') |
|
412 | print('You may wish to rerun these, with:') | |
401 | print(' iptest', *failed_sections) |
|
413 | print(' iptest', *failed_sections) |
@@ -88,6 +88,13 b" def unquote_filename(name, win32=(sys.platform=='win32')):" | |||||
88 | name = name[1:-1] |
|
88 | name = name[1:-1] | |
89 | return name |
|
89 | return name | |
90 |
|
90 | |||
|
91 | def compress_user(path): | |||
|
92 | """Reverse of :func:`os.path.expanduser` | |||
|
93 | """ | |||
|
94 | home = os.path.expanduser('~') | |||
|
95 | if path.startswith(home): | |||
|
96 | path = "~" + path[len(home):] | |||
|
97 | return path | |||
91 |
|
98 | |||
92 | def get_py_filename(name, force_win32=None): |
|
99 | def get_py_filename(name, force_win32=None): | |
93 | """Return a valid python filename in the current directory. |
|
100 | """Return a valid python filename in the current directory. |
@@ -93,6 +93,11 b' def pkg_info(pkg_path):' | |||||
93 | default_encoding=encoding.DEFAULT_ENCODING, |
|
93 | default_encoding=encoding.DEFAULT_ENCODING, | |
94 | ) |
|
94 | ) | |
95 |
|
95 | |||
|
96 | def get_sys_info(): | |||
|
97 | """Return useful information about IPython and the system, as a dict.""" | |||
|
98 | p = os.path | |||
|
99 | path = p.dirname(p.abspath(p.join(__file__, '..'))) | |||
|
100 | return pkg_info(path) | |||
96 |
|
101 | |||
97 | @py3compat.doctest_refactor_print |
|
102 | @py3compat.doctest_refactor_print | |
98 | def sys_info(): |
|
103 | def sys_info(): | |
@@ -112,11 +117,8 b' def sys_info():' | |||||
112 | 'sys_executable': '/usr/bin/python', |
|
117 | 'sys_executable': '/usr/bin/python', | |
113 | 'sys_platform': 'linux2', |
|
118 | 'sys_platform': 'linux2', | |
114 | 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \\n[GCC 4.4.5]'} |
|
119 | 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \\n[GCC 4.4.5]'} | |
115 | """ |
|
120 | """ | |
116 | p = os.path |
|
121 | return pprint.pformat(get_sys_info()) | |
117 | path = p.dirname(p.abspath(p.join(__file__, '..'))) |
|
|||
118 | return pprint.pformat(pkg_info(path)) |
|
|||
119 |
|
||||
120 |
|
122 | |||
121 | def _num_cpus_unix(): |
|
123 | def _num_cpus_unix(): | |
122 | """Return the number of active CPUs on a Unix system.""" |
|
124 | """Return the number of active CPUs on a Unix system.""" |
General Comments 0
You need to be logged in to leave comments.
Login now