[svn r58319] be more grateful on tests that disappear during a looponfailing session.

--HG--
branch : trunk
This commit is contained in:
hpk 2008-09-22 15:15:47 +02:00
parent e4e1e9f26d
commit e63da23050
2 changed files with 35 additions and 2 deletions

View File

@ -137,8 +137,14 @@ def slave_runsession(channel, config, width, hasmarkup):
session.reporter._tw.hasmarkup = hasmarkup
session.reporter._tw.fullwidth = width
if trails:
colitems = [py.test.collect.Collector._fromtrail(x, config)
for x in trails]
colitems = []
for trail in trails:
try:
colitem = py.test.collect.Collector._fromtrail(trail, config)
except AssertionError, e:
#XXX session.bus.notify of "test disappeared"
continue
colitems.append(colitem)
else:
colitems = None
session.shouldclose = channel.isclosed

View File

@ -112,3 +112,30 @@ class TestLooponFailing(suptest.InlineCollection):
session.loop_once(loopstate)
assert len(loopstate.colitems) == 1
def test_looponfailing_removed_test(self):
modcol = self.getmodulecol("""
def test_one():
assert 0
def test_two():
assert 0
""")
session = LooponfailingSession(modcol._config)
loopstate = LoopState()
session.remotecontrol.setup()
loopstate.colitems = []
session.loop_once(loopstate)
assert len(loopstate.colitems) == 2
modcol.fspath.write(py.code.Source("""
def test_xxx(): # renamed test
assert 0
def test_two():
assert 1 # pass now
"""))
assert session.statrecorder.check()
session.loop_once(loopstate)
assert len(loopstate.colitems) == 0
session.loop_once(loopstate)
assert len(loopstate.colitems) == 1