[py-svn] r58093 - in py/trunk/py/test/report: . testing
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 12 21:54:46 CEST 2008
Author: arigo
Date: Fri Sep 12 21:54:41 2008
New Revision: 58093
Modified:
py/trunk/py/test/report/terminal.py
py/trunk/py/test/report/testing/test_terminal.py
Log:
(pedronis, arigo)
Show tracebacks for the failures even when py.test is
interrupted by Ctrl-C.
Modified: py/trunk/py/test/report/terminal.py
==============================================================================
--- py/trunk/py/test/report/terminal.py (original)
+++ py/trunk/py/test/report/terminal.py Fri Sep 12 21:54:41 2008
@@ -129,10 +129,9 @@
def rep_TestrunFinish(self, ev):
self._tw.line("")
- if ev.exitstatus == 0 or ev.exitstatus == 1:
- self.summary_failures()
- self.summary_skips()
- elif ev.exitstatus == 2:
+ self.summary_failures()
+ self.summary_skips()
+ if ev.exitstatus == 2:
self.write_sep("!", "KEYBOARD INTERRUPT")
self.summary_deselected()
self.summary_stats()
Modified: py/trunk/py/test/report/testing/test_terminal.py
==============================================================================
--- py/trunk/py/test/report/testing/test_terminal.py (original)
+++ py/trunk/py/test/report/testing/test_terminal.py Fri Sep 12 21:54:41 2008
@@ -206,3 +206,26 @@
s = popvalue(stringio)
print s
assert s.find("test_show_path_before_running_test.py") != -1
+
+ def test_keyboard_interrupt(self):
+ modcol = self.getmodulecol("""
+ def test_foobar():
+ assert 0
+ def test_spamegg():
+ import py; py.test.skip('skip me please!')
+ """, configargs=("--showskipsummary",), withsession=True)
+ stringio = py.std.cStringIO.StringIO()
+ rep = TerminalReporter(modcol._config, bus=self.session.bus, file=stringio)
+ rep.processevent(event.TestrunStart())
+ for item in self.session.genitems([modcol]):
+ ev = basic_run_report(item)
+ rep.processevent(ev)
+ s = popvalue(stringio)
+ assert s.find("test_keyboard_interrupt.py Fs") != -1
+ rep.processevent(event.TestrunFinish(exitstatus=2))
+ assert_stringio_contains_lines(stringio, [
+ " def test_foobar():",
+ "> assert 0",
+ "E assert 0",
+ ])
+ assert "Skipped: 'skip me please!'" in stringio.getvalue()
More information about the pytest-commit
mailing list