From 236d83418c1191d8be748ab09e11dfb664b39a85 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 30 Sep 2017 13:55:41 +0530 Subject: [PATCH] Simple scan_code_imports test. --- tests/master_test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/master_test.py b/tests/master_test.py index 2bea6193..deb9e93a 100644 --- a/tests/master_test.py +++ b/tests/master_test.py @@ -7,6 +7,20 @@ import testlib import mitogen.master +class ScanCodeImportsTest(unittest.TestCase): + func = staticmethod(mitogen.master.scan_code_imports) + + def test_simple(self): + co = compile(open(__file__).read(), __file__, 'exec') + self.assertEquals(list(self.func(co)), [ + (-1, 'subprocess', ()), + (-1, 'time', ()), + (-1, 'unittest', ()), + (-1, 'testlib', ()), + (-1, 'mitogen.master', ()), + ]) + + class IterReadTest(unittest.TestCase): func = staticmethod(mitogen.master.iter_read) @@ -96,3 +110,7 @@ class WriteAllTest(unittest.TestCase): )) finally: proc.terminate() + + +if __name__ == '__main__': + unittest.main()