diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-04-11 12:27:06 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-04-11 12:27:06 +0200 |
commit | cccfa3decba1b2e16a3edaeb8d65415637972bb2 (patch) | |
tree | d7b5f72a306e2eaa8bca2e0fffade79f03b79eba | |
parent | 10c2fa4fa5de9b10f186a864067de1ac6f621952 (diff) | |
download | cython-cccfa3decba1b2e16a3edaeb8d65415637972bb2.tar.gz |
Skip numpy inline test rather than discarding it if numpy is not installed.
-rw-r--r-- | Cython/Build/Tests/TestInline.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Cython/Build/Tests/TestInline.py b/Cython/Build/Tests/TestInline.py index d20948808..f80cbf209 100644 --- a/Cython/Build/Tests/TestInline.py +++ b/Cython/Build/Tests/TestInline.py @@ -1,4 +1,6 @@ -import os, tempfile +import os +import tempfile +import unittest from Cython.Shadow import inline from Cython.Build.Inline import safe_type from Cython.TestUtils import CythonTest @@ -86,11 +88,10 @@ class TestInline(CythonTest): 2.5 ) - if has_numpy: - - def test_numpy(self): - import numpy - a = numpy.ndarray((10, 20)) - a[0,0] = 10 - self.assertEqual(safe_type(a), 'numpy.ndarray[numpy.float64_t, ndim=2]') - self.assertEqual(inline("return a[0,0]", a=a, **self.test_kwds), 10.0) + @unittest.skipIf(not has_numpy, "NumPy is not available") + def test_numpy(self): + import numpy + a = numpy.ndarray((10, 20)) + a[0,0] = 10 + self.assertEqual(safe_type(a), 'numpy.ndarray[numpy.float64_t, ndim=2]') + self.assertEqual(inline("return a[0,0]", a=a, **self.test_kwds), 10.0) |