From e9a6e4c3d216b3c77878d141d4cecaf1ef570d8d Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 3 Nov 2018 12:39:29 +0000 Subject: [PATCH] issue #406: add test. --- tests/broker_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/broker_test.py b/tests/broker_test.py index 7d070e3d..c35e6161 100644 --- a/tests/broker_test.py +++ b/tests/broker_test.py @@ -1,6 +1,7 @@ import threading +import mock import unittest2 import testlib @@ -8,6 +9,19 @@ import testlib import mitogen.core +class ShutdownTest(testlib.TestCase): + klass = mitogen.core.Broker + + def test_poller_closed(self): + broker = self.klass() + actual_close = broker.poller.close + broker.poller.close = mock.Mock() + broker.shutdown() + broker.join() + self.assertEquals(1, len(broker.poller.close.mock_calls)) + actual_close() + + class DeferSyncTest(testlib.TestCase): klass = mitogen.core.Broker