summaryrefslogtreecommitdiff
path: root/tests/build/cythonize_cython.srctree
blob: 1712436e36114f4d94a90a4d2b5246d256dc3bab (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
PYTHON -c "import cythonize_tests"
PYTHON -c "import cython_tests"

######## cythonize_tests.py ########

from Cython.Build.Cythonize import main as cythonize

for test_case in ["cython.pyx", "src2/cython.pyx", "src/cython/helper.pyx"]:
    try:
        cythonize([test_case])
    except ValueError:
        pass
    else:
        assert False, "ValueError not raised - forbidding cythonize "+test_case+" doesn't work"

for test_case in ["notcython.pyx", "my_module/cython.pyx", "cythontest/helper.pyx"]:
    try:
        cythonize([test_case])
    except ValueError:
        assert False, "ValueError raised - cythonize "+test_case+" should work"
    else:
        pass

######## cython_tests.py ########


from Cython.Compiler.Main import main as cython
import sys

for test_case in ["cython.pyx", "scr2/cython.pyx", "src/cython/helper.pyx"]:
    sys.argv=["cython", test_case]  #cython.py will extract parameters from sys.argv
    try:
        cython(command_line=1)
    except ValueError:
        pass
    else:
        assert False, "ValueError not raised - forbidding cython "+test_case+" doesn't work"


for test_case in ["notcython.pyx", "my_module/cython.pyx", "cythontest/helper.pyx"]:
    sys.argv=["cython", test_case]  #cython.py will extract parameters from sys.argv
    try:
        cython([test_case])
    except ValueError:
        assert False, "ValueError raised - cython "+test_case+" should work"
    else:
        pass


######## cython.pyx ########
######## my_module/__init__.py ########
######## my_module/cython.pyx ########
######## notcython.pyx ########
######## src2/cython.pyx ########
######## src/cython/__init__.py ########
######## src/cython/helper.pyx ########
######## cythontest/__init__.py ########
######## cythontest/helper.pyx ########