[py-svn] r58319 - in py/trunk/py/test/looponfail: . testing
hpk at codespeak.net
hpk at codespeak.net
Mon Sep 22 15:15:47 CEST 2008
Author: hpk
Date: Mon Sep 22 15:15:47 2008
New Revision: 58319
Modified:
py/trunk/py/test/looponfail/remote.py
py/trunk/py/test/looponfail/testing/test_remote.py
Log:
be more grateful on tests that disappear during a looponfailing session.
Modified: py/trunk/py/test/looponfail/remote.py
==============================================================================
--- py/trunk/py/test/looponfail/remote.py (original)
+++ py/trunk/py/test/looponfail/remote.py Mon Sep 22 15:15:47 2008
@@ -137,8 +137,14 @@
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
Modified: py/trunk/py/test/looponfail/testing/test_remote.py
==============================================================================
--- py/trunk/py/test/looponfail/testing/test_remote.py (original)
+++ py/trunk/py/test/looponfail/testing/test_remote.py Mon Sep 22 15:15:47 2008
@@ -112,3 +112,30 @@
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
More information about the pytest-commit
mailing list