From f22d05a7adeddcf0b852737a0c96c52dd317438e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 2 Oct 2017 13:56:02 +0530 Subject: [PATCH] frameworkize nested_test. --- tests/nested_test.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/nested_test.py b/tests/nested_test.py index c545c6b2..79325335 100644 --- a/tests/nested_test.py +++ b/tests/nested_test.py @@ -1,14 +1,19 @@ import os -import mitogen.utils +import unittest -@mitogen.utils.run_with_router -def main(router): - mitogen.utils.log_to_file() +import testlib - context = None - for x in range(1, 11): - print 'Connect local%d via %s' % (x, context) - context = router.local(via=context, name='local%d' % x) - context.call(os.system, 'pstree -s python -s mitogen') +class NestedTest(testlib.RouterMixin, testlib.TestCase): + def test_nested(self): + context = None + for x in range(1, 11): + #print 'Connect local%d via %s' % (x, context) + context = self.router.local(via=context, name='local%d' % x) + pid = context.call(os.getpid) + self.assertTrue(isinstance(pid, int)) + + +if __name__ == '__main__': + unittest.main()