fix issue 7 (delay in test writing)
--HG-- branch : trunk
This commit is contained in:
parent
86030ee645
commit
1f14aacbc2
|
@ -149,8 +149,10 @@ class TerminalReporter:
|
||||||
# ensure that the path is printed before the 1st test of
|
# ensure that the path is printed before the 1st test of
|
||||||
# a module starts running
|
# a module starts running
|
||||||
line = self._metainfoline(item)
|
line = self._metainfoline(item)
|
||||||
#self.write_fspath_result(fspath, "")
|
|
||||||
self.write_ensure_prefix(line, "")
|
self.write_ensure_prefix(line, "")
|
||||||
|
else:
|
||||||
|
fspath, lineno, msg = item.metainfo()
|
||||||
|
self.write_fspath_result(fspath, "")
|
||||||
|
|
||||||
def pytest_rescheduleitems(self, items):
|
def pytest_rescheduleitems(self, items):
|
||||||
if self.config.option.debug:
|
if self.config.option.debug:
|
||||||
|
@ -556,16 +558,10 @@ class TestTerminal:
|
||||||
linecomp.stringio.truncate(0)
|
linecomp.stringio.truncate(0)
|
||||||
|
|
||||||
def test_show_path_before_running_test(self, testdir, linecomp):
|
def test_show_path_before_running_test(self, testdir, linecomp):
|
||||||
modcol = testdir.getmodulecol("""
|
item = testdir.getitem("def test_func(): pass")
|
||||||
def test_foobar():
|
rep = TerminalReporter(item.config, file=linecomp.stringio)
|
||||||
pass
|
item.config.pluginmanager.register(rep)
|
||||||
""")
|
rep.config.api.pytest_itemstart(item=item)
|
||||||
rep = TerminalReporter(modcol.config, file=linecomp.stringio)
|
|
||||||
modcol.config.pluginmanager.register(rep)
|
|
||||||
l = list(testdir.genitems([modcol]))
|
|
||||||
assert len(l) == 1
|
|
||||||
modcol.config.option.debug = True
|
|
||||||
rep.config.api.pytest_itemstart(item=l[0])
|
|
||||||
linecomp.assert_contains_lines([
|
linecomp.assert_contains_lines([
|
||||||
"*test_show_path_before_running_test.py*"
|
"*test_show_path_before_running_test.py*"
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue