mitogen/tests/master_test.py

25 lines
590 B
Python
Raw Normal View History

import inspect
import unittest2
import testlib
import mitogen.master
class ScanCodeImportsTest(unittest2.TestCase):
2017-09-30 08:25:41 +00:00
func = staticmethod(mitogen.master.scan_code_imports)
def test_simple(self):
source_path = inspect.getsourcefile(ScanCodeImportsTest)
co = compile(open(source_path).read(), source_path, 'exec')
2017-09-30 08:25:41 +00:00
self.assertEquals(list(self.func(co)), [
(-1, 'inspect', ()),
(-1, 'unittest2', ()),
2017-09-30 08:25:41 +00:00
(-1, 'testlib', ()),
(-1, 'mitogen.master', ()),
])
if __name__ == '__main__':
unittest2.main()