From 9267c204e9da9dd3ef8e46de621c43c415655740 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 22 Mar 2017 10:31:08 -0700 Subject: [PATCH] test_wormhole_new: oops, forgot yield on assertFailure This was breaking the last test that gets run (test_xfer_util) because of the lingering failures. --- src/wormhole/test/test_wormhole_new.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/wormhole/test/test_wormhole_new.py b/src/wormhole/test/test_wormhole_new.py index 7455acb..92333b6 100644 --- a/src/wormhole/test/test_wormhole_new.py +++ b/src/wormhole/test/test_wormhole_new.py @@ -36,7 +36,7 @@ class New(ServerBase, unittest.TestCase): mo = re.search(r"^\d+-\w+-\w+$", code) self.assert_(mo, code) # w.close() fails because we closed before connecting - self.assertFailure(w.close(), errors.LonelyError) + yield self.assertFailure(w.close(), errors.LonelyError) def test_delegated(self): dg = Delegate() @@ -94,6 +94,12 @@ class New(ServerBase, unittest.TestCase): w1.send(b"data") - self.assertFailure(w2.when_received(), errors.WrongPasswordError) - self.assertFailure(w1.close(), errors.WrongPasswordError) - self.assertFailure(w2.close(), errors.WrongPasswordError) + yield self.assertFailure(w2.when_received(), errors.WrongPasswordError) + # wait for w1.when_received, because if we close w1 before it has + # seen the VERSION message, we could legitimately get LonelyError + # instead of WrongPasswordError. w2 didn't send anything, so + # w1.when_received wouldn't ever callback, but it will errback when + # w1 gets the undecryptable VERSION. + yield self.assertFailure(w1.when_received(), errors.WrongPasswordError) + yield self.assertFailure(w1.close(), errors.WrongPasswordError) + yield self.assertFailure(w2.close(), errors.WrongPasswordError)