core: Ensure add_handler() callbacks really receive _DEAD on shutdown
parent
de1b3602e5
commit
afc8697288
@ -0,0 +1,26 @@
|
||||
import Queue
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import unittest2
|
||||
|
||||
import testlib
|
||||
import mitogen.master
|
||||
import mitogen.utils
|
||||
|
||||
mitogen.utils.log_to_file()
|
||||
|
||||
class AddHandlerTest(unittest2.TestCase):
|
||||
klass = mitogen.master.Router
|
||||
|
||||
def test_invoked_at_shutdown(self):
|
||||
router = self.klass()
|
||||
queue = Queue.Queue()
|
||||
handle = router.add_handler(queue.put)
|
||||
router.broker.shutdown()
|
||||
self.assertEquals(queue.get(timeout=5), mitogen.core._DEAD)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
||||
|
Loading…
Reference in New Issue