Commit bb7f16dd authored by Stefan Behnel's avatar Stefan Behnel

added test cases for pyximport

parent 7e039fc9
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"
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"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment