[svn r58092] Ensure that the path is printed before the 1st test of

a module starts running (even when -v is not specified).

--HG--
branch : trunk
This commit is contained in:
arigo 2008-09-12 21:41:31 +02:00
parent a9c4c9876c
commit faec0dfa0b
2 changed files with 19 additions and 0 deletions

View File

@ -93,6 +93,11 @@ class TerminalReporter(BaseReporter):
if ev.host: if ev.host:
extra = "-> " + ev.host.hostid extra = "-> " + ev.host.hostid
self.write_ensure_prefix(line, extra) self.write_ensure_prefix(line, extra)
else:
# ensure that the path is printed before the 1st test of
# a module starts running
fspath = ev.item.fspath
self.write_fspath_result(fspath, "")
def rep_RescheduleItems(self, ev): def rep_RescheduleItems(self, ev):
if self.config.option.debug: if self.config.option.debug:

View File

@ -192,3 +192,17 @@ class TestTerminal(InlineCollection):
assert 'FAILURES' not in s assert 'FAILURES' not in s
assert '--calling--' not in s assert '--calling--' not in s
assert 'IndexError' not in s assert 'IndexError' not in s
def test_show_path_before_running_test(self):
modcol = self.getmodulecol("""
def test_foobar():
pass
""", withsession=True)
stringio = py.std.cStringIO.StringIO()
rep = TerminalReporter(modcol._config, bus=self.session.bus, file=stringio)
l = list(self.session.genitems([modcol]))
assert len(l) == 1
rep.processevent(event.ItemStart(l[0]))
s = popvalue(stringio)
print s
assert s.find("test_show_path_before_running_test.py") != -1