From faec0dfa0b55818c89db53151d69fa0925029095 Mon Sep 17 00:00:00 2001 From: arigo Date: Fri, 12 Sep 2008 21:41:31 +0200 Subject: [PATCH] [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 --- py/test/report/terminal.py | 5 +++++ py/test/report/testing/test_terminal.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/py/test/report/terminal.py b/py/test/report/terminal.py index d0bac6cb4..62787fbcc 100644 --- a/py/test/report/terminal.py +++ b/py/test/report/terminal.py @@ -93,6 +93,11 @@ class TerminalReporter(BaseReporter): if ev.host: extra = "-> " + ev.host.hostid 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): if self.config.option.debug: diff --git a/py/test/report/testing/test_terminal.py b/py/test/report/testing/test_terminal.py index 52dd952cb..632159425 100644 --- a/py/test/report/testing/test_terminal.py +++ b/py/test/report/testing/test_terminal.py @@ -192,3 +192,17 @@ class TestTerminal(InlineCollection): assert 'FAILURES' not in s assert '--calling--' 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