summaryrefslogtreecommitdiff
path: root/tests/build/cythonize_options.srctree
diff options
context:
space:
mode:
Diffstat (limited to 'tests/build/cythonize_options.srctree')
-rw-r--r--tests/build/cythonize_options.srctree40
1 files changed, 32 insertions, 8 deletions
diff --git a/tests/build/cythonize_options.srctree b/tests/build/cythonize_options.srctree
index 56e38be61..0dc7f724f 100644
--- a/tests/build/cythonize_options.srctree
+++ b/tests/build/cythonize_options.srctree
@@ -1,3 +1,5 @@
+# mode: run
+
PYTHON setup.py build_ext --inplace
PYTHON -c "import a"
@@ -5,11 +7,35 @@ PYTHON -c "import a"
from Cython.Build.Dependencies import cythonize
+import sys
from distutils.core import setup
+try:
+ # io.StringIO cannot handle 'str' in Py2
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+old_stderr = sys.stderr
+captured = sys.stderr = StringIO()
+try:
+ setup(
+ ext_modules = cythonize(
+ "*.pyx", include_path=['subdir'],
+ compiler_directives={'cdivision': True},
+ show_all_warnings=True,
+ ),
+ )
+ output = sys.stderr.getvalue()
+finally:
+ sys.stderr = old_stderr
+ sys.stderr.write(captured.getvalue())
+
+assert "Unraisable exception in function" in output, output
+
-setup(
- ext_modules = cythonize("*.pyx", include_path=['subdir'], compiler_directives={'cdivision': True}),
-)
+######## subdir/x.pxd ########
+
+######## subdir/y.pxi ########
######## a.pyx ########
@@ -22,8 +48,6 @@ def mod_int_c(int a, int b):
assert mod_int_c(-1, 10) < 0
-
-######## subdir/x.pxd ########
-
-######## subdir/y.pxi ########
-
+# unraisable exceptions should produce a warning
+cdef int no_exc_propagate() noexcept:
+ raise TypeError()