From bb7f16dd0ac008ca79a72b06381fe307e0d539f4 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 7 Aug 2012 17:22:11 +0200 Subject: [PATCH] added test cases for pyximport --- tests/pyximport/pyximport_basic.srctree | 18 ++++++++++++++++++ tests/pyximport/pyximport_pyimport.srctree | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/pyximport/pyximport_basic.srctree create mode 100644 tests/pyximport/pyximport_pyimport.srctree diff --git a/tests/pyximport/pyximport_basic.srctree b/tests/pyximport/pyximport_basic.srctree new file mode 100644 index 0000000..c03ee1d --- /dev/null +++ b/tests/pyximport/pyximport_basic.srctree @@ -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 index 0000000..affe3b4 --- /dev/null +++ b/tests/pyximport/pyximport_pyimport.srctree @@ -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" -- 2.7.4