tests: don't call Router.shutdown() twice.

Due to 497234e7 / issue #456.
issue510
David Wilson 6 years ago
parent b2b7e7b06b
commit 9da6e6a9a8

@ -97,6 +97,7 @@ class CallFunctionTest(testlib.RouterMixin, testlib.TestCase):
recv = self.local.call_async(time.sleep, 120) recv = self.local.call_async(time.sleep, 120)
time.sleep(0.05) # Ensure GIL is released time.sleep(0.05) # Ensure GIL is released
self.broker.shutdown() self.broker.shutdown()
self.broker_shutdown = True
exc = self.assertRaises(mitogen.core.ChannelError, exc = self.assertRaises(mitogen.core.ChannelError,
lambda: recv.get()) lambda: recv.get())
self.assertEquals(exc.args[0], self.router.respondent_disconnect_msg) self.assertEquals(exc.args[0], self.router.respondent_disconnect_msg)

@ -388,13 +388,15 @@ class DockerizedSshDaemon(object):
class BrokerMixin(object): class BrokerMixin(object):
broker_class = mitogen.master.Broker broker_class = mitogen.master.Broker
broker_shutdown = False
def setUp(self): def setUp(self):
super(BrokerMixin, self).setUp() super(BrokerMixin, self).setUp()
self.broker = self.broker_class() self.broker = self.broker_class()
def tearDown(self): def tearDown(self):
self.broker.shutdown() if not self.broker_shutdown:
self.broker.shutdown()
self.broker.join() self.broker.join()
super(BrokerMixin, self).tearDown() super(BrokerMixin, self).tearDown()

Loading…
Cancel
Save