|
|
@ -6,27 +6,27 @@ import mitogen.master
|
|
|
|
import mitogen.utils
|
|
|
|
import mitogen.utils
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def func0(broker):
|
|
|
|
def func0(router):
|
|
|
|
return broker
|
|
|
|
return router
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mitogen.utils.with_broker
|
|
|
|
@mitogen.utils.with_router
|
|
|
|
def func(broker):
|
|
|
|
def func(router):
|
|
|
|
return broker
|
|
|
|
return router
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RunWithBrokerTest(unittest.TestCase):
|
|
|
|
class RunWithRouterTest(unittest.TestCase):
|
|
|
|
# test_shutdown_on_exception
|
|
|
|
# test_shutdown_on_exception
|
|
|
|
# test_shutdown_on_success
|
|
|
|
# test_shutdown_on_success
|
|
|
|
|
|
|
|
|
|
|
|
def test_run_with_broker(self):
|
|
|
|
def test_run_with_broker(self):
|
|
|
|
broker = mitogen.utils.run_with_broker(func0)
|
|
|
|
router = mitogen.utils.run_with_router(func0)
|
|
|
|
self.assertTrue(isinstance(broker, mitogen.master.Broker))
|
|
|
|
self.assertTrue(isinstance(router, mitogen.master.Router))
|
|
|
|
self.assertFalse(broker._thread.isAlive())
|
|
|
|
self.assertFalse(router.broker._thread.isAlive())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WithBrokerTest(unittest.TestCase):
|
|
|
|
class WithRouterTest(unittest.TestCase):
|
|
|
|
def test_with_broker(self):
|
|
|
|
def test_with_broker(self):
|
|
|
|
broker = func()
|
|
|
|
router = func()
|
|
|
|
self.assertTrue(isinstance(broker, mitogen.master.Broker))
|
|
|
|
self.assertTrue(isinstance(router, mitogen.master.Router))
|
|
|
|
self.assertFalse(broker._thread.isAlive())
|
|
|
|
self.assertFalse(router.broker._thread.isAlive())
|
|
|
|