mitogen/tests/master_test.py

26 lines
615 B
Python
Raw Normal View History

import inspect
import testlib
import mitogen.master
class ScanCodeImportsTest(testlib.TestCase):
2017-09-30 08:25:41 +00:00
func = staticmethod(mitogen.master.scan_code_imports)
if mitogen.core.PY3:
level = 0
else:
level = -1
SIMPLE_EXPECT = [
(level, 'inspect', ()),
(level, 'testlib', ()),
(level, 'mitogen.master', ()),
]
2017-09-30 08:25:41 +00:00
def test_simple(self):
source_path = inspect.getsourcefile(ScanCodeImportsTest)
with open(source_path) as f:
co = compile(f.read(), source_path, 'exec')
self.assertEqual(list(self.func(co)), self.SIMPLE_EXPECT)