File: master_test.py

package info (click to toggle)
python-mitogen 0.3.0~rc1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,240 kB
  • sloc: python: 19,899; sh: 91; perl: 19; ansic: 18; makefile: 13
file content (31 lines) | stat: -rw-r--r-- 693 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import inspect

import unittest2

import testlib
import mitogen.master


class ScanCodeImportsTest(testlib.TestCase):
    func = staticmethod(mitogen.master.scan_code_imports)

    if mitogen.core.PY3:
        level = 0
    else:
        level = -1

    SIMPLE_EXPECT = [
        (level, 'inspect', ()),
        (level, 'unittest2', ()),
        (level, 'testlib', ()),
        (level, 'mitogen.master', ()),
    ]

    def test_simple(self):
        source_path = inspect.getsourcefile(ScanCodeImportsTest)
        co = compile(open(source_path).read(), source_path, 'exec')
        self.assertEquals(list(self.func(co)), self.SIMPLE_EXPECT)


if __name__ == '__main__':
    unittest2.main()