Commit d6f0b23a authored by Ronan Lamy's avatar Ronan Lamy

Fix module.__file__ checks to work on pypy

Note that on pypy, SOABI tags start with '.pypy' which contains
the string '.py'...
parent dbdebb8d
''' '''
PYTHON -m Cython.Build.Cythonize -i '**/*_test.py' PYTHON -m Cython.Build.Cythonize -i '**/*_test.py'
PYTHON -c "import cy_test; assert cy_test.TEST == 'cy_test', cy_test.TEST; assert '.py' not in cy_test.__file__, cy_test.__file__" PYTHON -c "import cy_test; assert cy_test.TEST == 'cy_test', cy_test.TEST; assert not cy_test.__file__.rstrip('oc').endswith('.py'), cy_test.__file__"
PYTHON -c "import pkg.cy_test; assert pkg.cy_test.TEST == 'pkg.cy_test', pkg.cy_test.TEST; assert '.py' not in pkg.cy_test.__file__, pkg.cy_test.__file__" PYTHON -c "import pkg.cy_test; assert pkg.cy_test.TEST == 'pkg.cy_test', pkg.cy_test.TEST; assert not pkg.cy_test.__file__.rstrip('oc').endswith('.py'), pkg.cy_test.__file__"
PYTHON -c "import pkg.sub.cy_test; assert pkg.sub.cy_test.TEST == 'pkg.sub.cy_test', pkg.sub.cy_test.TEST; assert '.py' not in pkg.sub.cy_test.__file__, pkg.cy_test.__file__" PYTHON -c "import pkg.sub.cy_test; assert pkg.sub.cy_test.TEST == 'pkg.sub.cy_test', pkg.sub.cy_test.TEST; assert not pkg.sub.cy_test.__file__.rstrip('oc').endswith('.py'), pkg.cy_test.__file__"
''' '''
######## cy_test.py ######## ######## cy_test.py ########
......
...@@ -11,7 +11,7 @@ if sys.version_info[0] < 3 or sys.version_info >= (3,3): ...@@ -11,7 +11,7 @@ if sys.version_info[0] < 3 or sys.version_info >= (3,3):
# __init__.py compilation isn't supported in Py 3.[012] # __init__.py compilation isn't supported in Py 3.[012]
import pkg.sub.test import pkg.sub.test
assert pkg.sub.test.TEST == 'pkg.sub.test' assert pkg.sub.test.TEST == 'pkg.sub.test'
assert '.py' not in pkg.sub.test.__file__ assert not pkg.sub.test.__file__.rstrip('oc').endswith('.py')
######## test.py ######## ######## test.py ########
......
PYTHON setup.py build_ext --inplace PYTHON setup.py build_ext --inplace
PYTHON -c "import toppkg; assert '.py' not in toppkg.__file__; assert toppkg.PACKAGE == 1" PYTHON -c "import toppkg; assert not toppkg.__file__.rstrip('oc').endswith('.py'); assert toppkg.PACKAGE == 1"
PYTHON -c "import toppkg.subpkg; assert '.py' not in toppkg.__file__; assert '.py' not in toppkg.subpkg.__file__; assert toppkg.subpkg.PACKAGE == 2" PYTHON -c "import toppkg.subpkg; assert not toppkg.__file__.rstrip('oc').endswith('.py'); assert not toppkg.subpkg.__file__.rstrip('oc').endswith('.py'); assert toppkg.subpkg.PACKAGE == 2"
PYTHON -c "import toppkg.a; assert toppkg.a.MODULE == 'a'" PYTHON -c "import toppkg.a; assert toppkg.a.MODULE == 'a'"
PYTHON -c "from toppkg.subpkg import a; assert a.MODULE == 'subpkg.a'" PYTHON -c "from toppkg.subpkg import a; assert a.MODULE == 'subpkg.a'"
......
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