Commit 32d029ed authored by David Wilson's avatar David Wilson

Add test that hangs the main thread during shutdown.

parent 3285fc2f
import logging import logging
import time
import unittest import unittest
import mitogen.core import mitogen.core
...@@ -71,7 +72,13 @@ class CallFunctionTest(testlib.RouterMixin, testlib.TestCase): ...@@ -71,7 +72,13 @@ class CallFunctionTest(testlib.RouterMixin, testlib.TestCase):
self.assertEquals(exc[0], mitogen.core.ChannelError.local_msg) self.assertEquals(exc[0], mitogen.core.ChannelError.local_msg)
def test_aborted_on_local_broker_shutdown(self): def test_aborted_on_local_broker_shutdown(self):
assert 0, 'todo' stream = self.router._stream_by_id[self.local.context_id]
recv = self.local.call_async(time.sleep, 120)
time.sleep(0.1) # Ensure GIL is released
self.broker.shutdown()
exc = self.assertRaises(mitogen.core.ChannelError,
lambda: recv.get())
self.assertEquals(exc[0], mitogen.core.ChannelError.local_msg)
def test_accepts_returns_context(self): def test_accepts_returns_context(self):
context = self.local.call(func_accepts_returns_context, self.local) context = self.local.call(func_accepts_returns_context, self.local)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment