test and fix looponfailing wrt to a bug introduced with the cmdline/session startup cleanup.

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-01-12 16:08:48 +01:00
parent 8d9e0712be
commit 1b0d6296dd
2 changed files with 24 additions and 2 deletions

View File

@ -22,9 +22,9 @@ class LooponfailingSession(Session):
self.remotecontrol = RemoteControl(self.config)
self.out = py.io.TerminalWriter()
def main(self, initialitems=None):
def main(self, initialitems):
try:
self.loopstate = loopstate = LoopState(initialitems)
self.loopstate = loopstate = LoopState([])
self.remotecontrol.setup()
while 1:
self.loop_once(loopstate)

View File

@ -127,3 +127,25 @@ class TestLooponFailing:
session.loop_once(loopstate)
assert len(loopstate.colitems) == 1
def test_looponfail_functional_fail_to_ok(self, testdir):
p = testdir.makepyfile("""
def test_one():
x = 0
assert x == 1
""")
child = testdir.spawn_pytest("-f %s" % p)
child.expect("def test_one")
child.expect("x == 1")
child.expect("1 failed")
child.expect("### LOOPONFAILING ####")
child.expect("waiting for changes")
p.write(py.code.Source("""
def test_one():
x = 1
assert x == 1
"""))
child.expect(".*1 passed.*")
child.kill(15)