added test cases for pyximport
authorStefan Behnel <stefan_ml@behnel.de>
Tue, 7 Aug 2012 15:22:11 +0000 (17:22 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Tue, 7 Aug 2012 15:22:11 +0000 (17:22 +0200)
tests/pyximport/pyximport_basic.srctree [new file with mode: 0644]
tests/pyximport/pyximport_pyimport.srctree [new file with mode: 0644]

diff --git a/tests/pyximport/pyximport_basic.srctree b/tests/pyximport/pyximport_basic.srctree
new file mode 100644 (file)
index 0000000..c03ee1d
--- /dev/null
@@ -0,0 +1,18 @@
+
+PYTHON -c "import basic_test; basic_test.test()"
+
+######## basic_test.py ########
+
+import os.path
+import pyximport
+
+pyximport.install(build_dir=os.path.join(os.path.dirname(__file__), "BUILD"))
+
+def test():
+    import mymodule
+    assert mymodule.test_string == "TEST"
+    assert not mymodule.__file__.rstrip('oc').endswith('.py'), mymodule.__file__
+
+######## mymodule.pyx ########
+
+test_string = "TEST"
diff --git a/tests/pyximport/pyximport_pyimport.srctree b/tests/pyximport/pyximport_pyimport.srctree
new file mode 100644 (file)
index 0000000..affe3b4
--- /dev/null
@@ -0,0 +1,23 @@
+
+PYTHON -s -S -c "import pyimport_test; pyimport_test.test()"
+
+######## pyimport_test.py ########
+
+import os.path
+import pyximport
+
+# blacklist for speed
+import pyximport.pyxbuild, Cython.Compiler.Pipeline
+import distutils.core, distutils.ccompiler, distutils.command.build
+
+pyximport.install(pyximport=False, pyimport=True,
+                  build_dir=os.path.join(os.path.dirname(__file__), "BUILD"))
+
+def test():
+    import mymodule
+    assert mymodule.test_string == "TEST"
+    assert not mymodule.__file__.rstrip('oc').endswith('.py'), mymodule.__file__
+
+######## mymodule.py ########
+
+test_string = "TEST"