Simple scan_code_imports test.

This commit is contained in:
David Wilson 2017-09-30 13:55:41 +05:30
parent 6f5d4882da
commit 236d83418c
1 changed files with 18 additions and 0 deletions

View File

@ -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()