summaryrefslogtreecommitdiff
path: root/tests/pyximport
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pyximport')
-rw-r--r--tests/pyximport/pyximport_basic.srctree2
-rw-r--r--tests/pyximport/pyximport_errors.srctree2
-rw-r--r--tests/pyximport/pyximport_namespace.srctree2
-rw-r--r--tests/pyximport/pyximport_pyimport.srctree9
-rw-r--r--tests/pyximport/pyximport_pyimport_only.srctree25
-rw-r--r--tests/pyximport/pyximport_pyxbld.srctree37
6 files changed, 75 insertions, 2 deletions
diff --git a/tests/pyximport/pyximport_basic.srctree b/tests/pyximport/pyximport_basic.srctree
index 13e01b870..e6e43d524 100644
--- a/tests/pyximport/pyximport_basic.srctree
+++ b/tests/pyximport/pyximport_basic.srctree
@@ -6,6 +6,8 @@ PYTHON -c "import basic_test; basic_test.test()"
import os.path
import pyximport
+pyximport.DEBUG_IMPORT = True
+
pyximport.install(build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
def test():
diff --git a/tests/pyximport/pyximport_errors.srctree b/tests/pyximport/pyximport_errors.srctree
index 015cca58f..d402e2b68 100644
--- a/tests/pyximport/pyximport_errors.srctree
+++ b/tests/pyximport/pyximport_errors.srctree
@@ -7,6 +7,8 @@ import os.path
from contextlib import contextmanager
import pyximport
+pyximport.DEBUG_IMPORT = True
+
pyximport.install(build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
@contextmanager
diff --git a/tests/pyximport/pyximport_namespace.srctree b/tests/pyximport/pyximport_namespace.srctree
index 5547bfdf8..cc4305d99 100644
--- a/tests/pyximport/pyximport_namespace.srctree
+++ b/tests/pyximport/pyximport_namespace.srctree
@@ -6,6 +6,8 @@ PYTHON -c "import basic_test; basic_test.test()"
import os.path
import pyximport
+pyximport.DEBUG_IMPORT = True
+
pyximport.install(build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
def test():
diff --git a/tests/pyximport/pyximport_pyimport.srctree b/tests/pyximport/pyximport_pyimport.srctree
index 69bc47988..a1e18ed16 100644
--- a/tests/pyximport/pyximport_pyimport.srctree
+++ b/tests/pyximport/pyximport_pyimport.srctree
@@ -8,7 +8,8 @@ import pyximport
# blacklist for speed
import pyximport.pyxbuild, Cython.Compiler.Pipeline
-import distutils.core, distutils.ccompiler, distutils.command.build
+
+pyximport.DEBUG_IMPORT = True
pyximport.install(pyximport=False, pyimport=True,
build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
@@ -16,8 +17,12 @@ pyximport.install(pyximport=False, pyimport=True,
def test():
import mymodule
assert mymodule.test_string == "TEST"
- assert not mymodule.__file__.rstrip('oc').endswith('.py'), mymodule.__file__
+ assert mymodule.compiled
######## mymodule.py ########
+import cython
+
+compiled = cython.compiled
+
test_string = "TEST"
diff --git a/tests/pyximport/pyximport_pyimport_only.srctree b/tests/pyximport/pyximport_pyimport_only.srctree
new file mode 100644
index 000000000..d1769fd98
--- /dev/null
+++ b/tests/pyximport/pyximport_pyimport_only.srctree
@@ -0,0 +1,25 @@
+
+PYTHON -c "import pyimport_test; pyimport_test.test()"
+
+######## pyimport_test.py ########
+
+import os.path
+import pyximport
+
+pyximport.DEBUG_IMPORT = True
+
+pyximport.install(pyximport=False, pyimport=True,
+ build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
+
+def test():
+ import mymodule
+ assert mymodule.test_string == "TEST"
+ assert mymodule.compiled
+
+######## mymodule.py ########
+
+import cython
+
+compiled = cython.compiled
+
+test_string = "TEST"
diff --git a/tests/pyximport/pyximport_pyxbld.srctree b/tests/pyximport/pyximport_pyxbld.srctree
new file mode 100644
index 000000000..b292e44c1
--- /dev/null
+++ b/tests/pyximport/pyximport_pyxbld.srctree
@@ -0,0 +1,37 @@
+
+PYTHON -c "import basic_test; basic_test.test()"
+
+######## basic_test.py ########
+
+import os.path
+import pyximport
+
+pyximport.DEBUG_IMPORT = True
+
+pyximport.install(build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
+
+def test():
+ import mymodule
+ assert mymodule.test_string == "TEST"
+ assert mymodule.header_value == 5
+ assert not mymodule.__file__.rstrip('oc').endswith('.py'), mymodule.__file__
+
+######## mymodule.pyxbld ########
+
+def make_ext(modname, pyxfilename):
+ from distutils.extension import Extension
+ return Extension(name = modname,
+ sources=[pyxfilename],
+ include_dirs=['./headers'] )
+
+######## mymodule.pyx ########
+
+cdef extern from "myheader.h":
+ int test_value
+
+header_value = test_value
+test_string = "TEST"
+
+######## headers/myheader.h ########
+
+static int test_value = 5;