From 2318c94169caac9b571079fac712edd2b17496bb Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 23 Nov 2015 16:49:46 -0800 Subject: [PATCH] test_server: error properly when EventSource fails --- src/wormhole/test/test_server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index 9166a0e..0073f57 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -328,6 +328,7 @@ class OneEventAtATime: def __init__(self, url, parser=lambda e: e): self.parser = parser self.d = None + self._connected = False self.connected_d = defer.Deferred() self.disconnected_d = defer.Deferred() self.events = [] @@ -358,11 +359,14 @@ class OneEventAtATime: def wait_for_connection(self): return self.connected_d def connected(self): + self._connected = True self.connected_d.callback(None) def wait_for_disconnection(self): return self.disconnected_d def disconnected(self, why): + if not self._connected: + self.connected_d.errback(why) self.disconnected_d.callback((why,)) class Summary(unittest.TestCase):