nose-progressive icon indicating copy to clipboard operation
nose-progressive copied to clipboard

Handle keyboard interrupt gracefully

Open wackywendell opened this issue 8 years ago • 0 comments

Standard nosetests handles KeyboardInterrupt gracefully:

$ nosetests
.........^C
----------------------------------------------------------------------
Ran 10 tests in 0.263s

OK

With --with-progressive, however, a keyboard interrupt crashes out:

$ nosetests --with-progressive

ERROR: noseprogressive.tests.test_tracebacks:test_proxied_syntax_error
  vi +107 noseprogressive/tests/test_tracebacks.py  # test_proxied_syntax_error
    ''.join(format_traceback(*proxied_syntax_tb))
  vi +82  /home/vagrant/python/local/lib/python2.7/site-packages/noseprogressive/tracebacks.py  # format_traceback
    exc_lines = [format_shortcut(editor, exc_value.filename, exc_value.lineno)]
AttributeError: 'SyntaxError' object has no attribute 'filename'

20 tests, 0 failures, 1 error in 0.2s
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 286, in _exit_function
    _run_finalizers(0)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 261, in _run_finalizers
    finalizer()
  File "/usr/lib/python2.7/multiprocessing/util.py", line 200, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/multiprocessing/managers.py", line 620, in _finalize_manager
    process.join(timeout=0.2)
  File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
    res = self._popen.wait(timeout)
  File "/usr/lib/python2.7/multiprocessing/forking.py", line 159, in wait
    time.sleep(delay)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 286, in _exit_function
    _run_finalizers(0)
  File "/usr/lib/python2.7/multiprocessing/util.py", line 261, in _run_finalizers
    finalizer()
  File "/usr/lib/python2.7/multiprocessing/util.py", line 200, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/multiprocessing/managers.py", line 620, in _finalize_manager
    process.join(timeout=0.2)
  File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
    res = self._popen.wait(timeout)
  File "/usr/lib/python2.7/multiprocessing/forking.py", line 159, in wait
    time.sleep(delay)
KeyboardInterrupt

It would be nice if this traceback was suppressed, and the summary printed, like standard nosetests behavior. I frequently run nosetests on a project that takes minutes to run, and ^C when I see a few errors can be useful.

wackywendell avatar Aug 11 '16 19:08 wackywendell