You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/utils_test.py

33 lines
737 B
Python

7 years ago
#!/usr/bin/env python
import unittest
import mitogen.master
import mitogen.utils
def func0(router):
return router
7 years ago
@mitogen.utils.with_router
def func(router):
return router
7 years ago
class RunWithRouterTest(unittest.TestCase):
7 years ago
# test_shutdown_on_exception
# test_shutdown_on_success
def test_run_with_broker(self):
router = mitogen.utils.run_with_router(func0)
self.assertTrue(isinstance(router, mitogen.master.Router))
self.assertFalse(router.broker._thread.isAlive())
7 years ago
class WithRouterTest(unittest.TestCase):
7 years ago
def test_with_broker(self):
router = func()
self.assertTrue(isinstance(router, mitogen.master.Router))
self.assertFalse(router.broker._thread.isAlive())