core: Ensure add_handler() callbacks really receive _DEAD on shutdown
parent
7db5834c18
commit
7a5d18835e
@ -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