extract normal cythonize script test from package compilation test as the latter...
authorStefan Behnel <stefan_ml@behnel.de>
Sun, 11 Aug 2013 15:27:08 +0000 (17:27 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Sun, 11 Aug 2013 15:27:08 +0000 (17:27 +0200)
--HG--
rename : tests/build/cythonize_script.srctree => tests/build/cythonize_script_package.srctree

tests/build/cythonize_script.srctree
tests/build/cythonize_script_package.srctree [new file with mode: 0644]

index fda090a..3d488f0 100644 (file)
@@ -1,24 +1,26 @@
 '''
-PYTHON -m Cython.Build.Cythonize -i pkg
-PYTHON -c "import pkg.sub.test; assert pkg.sub.test.TEST == 'pkg.sub.test'; assert '.py' not in pkg.sub.test.__file__"
+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 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.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__"
 '''
 
-######## test.py ########
+######## cy_test.py ########
 
-TEST = 'test'
+TEST = 'cy_test'
 
 ######## pkg/__init__.py ########
 
-######## pkg/test.py ########
+######## pkg/cy_test.py ########
 
-TEST = 'pkg.test'
+TEST = 'pkg.cy_test'
 
 ######## pkg/sub/__init__.py ########
 
-######## pkg/sub/test.py ########
+######## pkg/sub/cy_test.py ########
 # cython: language_level=3
 
-TEST = 'pkg.sub.test'
+TEST = 'pkg.sub.cy_test'
 
 ustring = 'abc'
 
diff --git a/tests/build/cythonize_script_package.srctree b/tests/build/cythonize_script_package.srctree
new file mode 100644 (file)
index 0000000..79d2dc0
--- /dev/null
@@ -0,0 +1,35 @@
+'''
+PYTHON -m Cython.Build.Cythonize -i pkg
+PYTHON package_test.py
+'''
+
+######## package_test.py ########
+
+import sys
+
+if sys.version_info[0] < 3 or sys.version_info >= (3,3):
+    # __init__.py compilation isn't supported in Py 3.[012]
+    import pkg.sub.test
+    assert pkg.sub.test.TEST == 'pkg.sub.test'
+    assert '.py' not in pkg.sub.test.__file__
+
+######## test.py ########
+
+TEST = 'test'
+
+######## pkg/__init__.py ########
+
+######## pkg/test.py ########
+
+TEST = 'pkg.test'
+
+######## pkg/sub/__init__.py ########
+
+######## pkg/sub/test.py ########
+# cython: language_level=3
+
+TEST = 'pkg.sub.test'
+
+ustring = 'abc'
+
+assert isinstance(ustring, unicode)