AssertionError when cancelling a test

Issue #96 resolved
Amaury Forgeot d'Arc
created an issue

I got this traceback when pressing Ctrl-C. This happens from time to time, and there is not line "!!! KEYBOARD INTERRUPT !!!"

{{{
module\cpyext\test\test_typeobject.py ..........
module\cpyext\test\test_unicodeobject.py Traceback (most recent call last):
File "C:\dev\pypy\trunk\pypy\test_all.py", line 6, in ?
py.cmdline.pytest()
File "C:\dev\pypy\trunk\py_test\cmdline.py", line 17, in main
exitstatus = session.main(colitems)
File "C:\dev\pypy\trunk\py_test\session.py", line 113, in main
self.config.hook.pytest_keyboard_interrupt(excinfo=excinfo)
File "C:\dev\pypy\trunk\py_test\pluginmanager.py", line 347, in call
return self.hookrelay._performcall(self.name, mc)
File "C:\dev\pypy\trunk\py_test\pluginmanager.py", line 333, in _performcall
return multicall.execute()
File "C:\dev\pypy\trunk\py_test\pluginmanager.py", line 244, in execute
res = method(**kwargs)
File "C:\dev\pypy\trunk\py_plugin\pytest_capture.py", line 232, in pytest_keyboard_interrupt
self.suspendcapture()
File "C:\dev\pypy\trunk\py_plugin\pytest_capture.py", line 170, in suspendcapture
outerr = cap.suspend()
File "C:\dev\pypy\trunk\py_io\capture.py", line 166, in suspend
assert not hasattr(self, '_suspended')
py._code.assertion.AssertionError: assert not hasattr(<py._io.capture.StdCaptureFD object at 0x01AC9250>, '_suspended')
}}}

Comments (4)

  1. Amaury Forgeot d'Arc reporter
    • changed status to open

    thats actually looking like a semantic bug in hasattr of cpython

    Can you elaborate? it's possible that the break occurred inside a regular call to suspendcapture(), before "del self._capturing". In this case suspendcapture() is called twice.

  2. Holger Krekel repo owner

    hi amaury,

    you are right - capturing and KeyboardInterrupt are not completely safe. There are several areas that are vulnerable, unfortunately. I'll look into it. holger

  3. Log in to comment