[py-svn] r57220 - in py/branch/event/py/test2: . report report/testing
hpk at codespeak.net
hpk at codespeak.net
Wed Aug 13 11:03:28 CEST 2008
Author: hpk
Date: Wed Aug 13 11:03:26 2008
New Revision: 57220
Modified:
py/branch/event/py/test2/event.py
py/branch/event/py/test2/report/terminal.py
py/branch/event/py/test2/report/testing/test_terminal.py
Log:
support for reporting looponfailinginfo events
Modified: py/branch/event/py/test2/event.py
==============================================================================
--- py/branch/event/py/test2/event.py (original)
+++ py/branch/event/py/test2/event.py Wed Aug 13 11:03:26 2008
@@ -101,6 +101,11 @@
super(CollectionReport, self).__init__(colitem, **kwargs)
self.result = result
+class LooponfailingInfo(BaseEvent):
+ def __init__(self, failreports, rootdirs):
+ self.failreports = failreports
+ self.rootdirs = rootdirs
+
# ----------------------------------------------------------------------
# Distributed Testing Events
# ----------------------------------------------------------------------
Modified: py/branch/event/py/test2/report/terminal.py
==============================================================================
--- py/branch/event/py/test2/report/terminal.py (original)
+++ py/branch/event/py/test2/report/terminal.py Wed Aug 13 11:03:26 2008
@@ -25,6 +25,7 @@
self._tw.write(res)
def write_line(self, line):
+ line = str(line)
if self.currentfspath:
self._tw.line()
self.currentfspath = None
@@ -72,6 +73,21 @@
self._tw.sep("!", "KEYBOARD INTERRUPT")
self.summary_stats()
+ def rep_LooponfailingInfo(self, ev):
+ self._tw.sep("#", "LOOPONFAILING")
+ if ev.failreports:
+ self.write_line("")
+ for report in ev.failreports:
+ if isinstance(report.colitem, py.test2.collect.Function):
+ loc = report.outcome.longrepr.reprcrash
+ else:
+ loc = str(report.colitem)
+ self.write_line(loc)
+ self.write_line("")
+ self.write_line("watching files below:")
+ for rootdir in ev.rootdirs:
+ self.write_line(" %s" %(rootdir,))
+ self._tw.sep("#", "waiting for changes")
#
# summaries for SessionFinish
Modified: py/branch/event/py/test2/report/testing/test_terminal.py
==============================================================================
--- py/branch/event/py/test2/report/testing/test_terminal.py (original)
+++ py/branch/event/py/test2/report/testing/test_terminal.py Wed Aug 13 11:03:26 2008
@@ -95,3 +95,23 @@
assert not lines[0]
assert lines[1].endswith("xy.py .")
assert lines[2] == "hello world"
+
+ def test_looponfailingreport(self):
+ modcol = self.getmodulecol([], """
+ def test_fail():
+ assert 0
+ def test_fail2():
+ raise ValueError()
+ """)
+ stringio = py.std.cStringIO.StringIO()
+ rep = TerminalReporter(modcol._config, file=stringio)
+ reports = [basic_run_report(modcol.join(x))
+ for x in modcol.listdir()]
+ rep.processevent(event.LooponfailingInfo(reports, [modcol._config.topdir]))
+ assert_stringio_contains_lines(stringio, [
+ "*test_looponfailingreport.py:2: assert 0",
+ "*test_looponfailingreport.py:4: ValueError*",
+ "*%s*" % (modcol._config.topdir),
+ "*waiting*",
+ ])
+
More information about the pytest-commit
mailing list