Debian Codegraph @

tests/build/package_compilation.srctree

raw
1 PYTHON setup.py build_ext --inplace
2 PYTHON -c "import toppkg; assert not toppkg.__file__.rstrip('oc').endswith('.py'); assert toppkg.PACKAGE == 1"
3 PYTHON -c "import toppkg.subpkg; assert not toppkg.__file__.rstrip('oc').endswith('.py'); assert not toppkg.subpkg.__file__.rstrip('oc').endswith('.py'); assert toppkg.subpkg.PACKAGE == 2"
4 PYTHON -c "import toppkg.a; assert toppkg.a.MODULE == 'a'"
5 PYTHON -c "from toppkg.subpkg import a; assert a.MODULE == 'subpkg.a'"
6
7 ######## setup.py ########
8
9
10 from Cython.Build import cythonize
11 from distutils.core import setup
12
13 setup(
14 ext_modules = cythonize("toppkg/**/*.py"),
15 )
16
17 ######## toppkg/__init__.py ########
18
19 import sys
20 assert 'toppkg' in sys.modules
21
22 assert __path__ is not None, "__path__ is None"
23
24 assert __path__, "__path__ is empty"
25 assert 'toppkg' in __path__[0], "toppkg not in __path__[0]"
26
27 assert 'toppkg' in __file__
28
29 from . import a
30 assert a.MODULE == 'a'
31
32 from . import b
33 assert b.MODULE == 'b'
34
35 PACKAGE = 1
36
37 ######## toppkg/a.py ########
38
39 MODULE = 'a'
40
41 ######## toppkg/b.py ########
42
43 MODULE = 'b'
44
45 ######## toppkg/subpkg/__init__.py ########
46
47 PACKAGE = 2
48
49 from . import a
50 assert a.__name__ == 'toppkg.subpkg.a'
51 assert a.MODULE == 'subpkg.a'
52
53 ######## toppkg/subpkg/a.py ########
54
55 MODULE = 'subpkg.a'