summaryrefslogtreecommitdiff
path: root/numpy/random/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2019-11-27 12:15:27 -0800
committerGitHub <noreply@github.com>2019-11-27 12:15:27 -0800
commit3fcf144be4939a6a785dc80b75189c2e05d6bd22 (patch)
treedc35c9d9142fceb8702def0789cd0d047a5cd9b2 /numpy/random/tests
parentd37908878e83d9799fa771863b58f4d7c5d38a93 (diff)
parente0519fe66c832c08b07ad2a68037cac901fed4f7 (diff)
downloadnumpy-3fcf144be4939a6a785dc80b75189c2e05d6bd22.tar.gz
Merge pull request #14954 from mattip/test-extending-cffi
TST. API: test using distributions.h via cffi
Diffstat (limited to 'numpy/random/tests')
-rw-r--r--numpy/random/tests/test_direct.py7
-rw-r--r--numpy/random/tests/test_extending.py17
2 files changed, 22 insertions, 2 deletions
diff --git a/numpy/random/tests/test_direct.py b/numpy/random/tests/test_direct.py
index 34d7bd278..9f77f0ad2 100644
--- a/numpy/random/tests/test_direct.py
+++ b/numpy/random/tests/test_direct.py
@@ -1,5 +1,6 @@
import os
from os.path import join
+import sys
import numpy as np
from numpy.testing import (assert_equal, assert_allclose, assert_array_equal,
@@ -26,6 +27,12 @@ try:
except ImportError:
MISSING_CTYPES = False
+if sys.flags.optimize > 1:
+ # no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1
+ # cffi cannot succeed
+ MISSING_CFFI = True
+
+
pwd = os.path.dirname(os.path.abspath(__file__))
diff --git a/numpy/random/tests/test_extending.py b/numpy/random/tests/test_extending.py
index efd922ff5..807de1a25 100644
--- a/numpy/random/tests/test_extending.py
+++ b/numpy/random/tests/test_extending.py
@@ -3,11 +3,20 @@ import pytest
import warnings
try:
+ import cffi
+except ImportError:
+ cffi = None
+
+if sys.flags.optimize > 1:
+ # no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1
+ # cffi cannot succeed
+ cffi = None
+
+try:
with warnings.catch_warnings(record=True) as w:
# numba issue gh-4733
warnings.filterwarnings('always', '', DeprecationWarning)
import numba
- import cffi
except ImportError:
numba = None
@@ -32,7 +41,11 @@ def test_cython():
sys.argv = argv
os.chdir(curdir)
-@pytest.mark.skipif(numba is None, reason="requires numba")
+@pytest.mark.skipif(numba is None or cffi is None,
+ reason="requires numba and cffi")
def test_numba():
from numpy.random._examples.numba import extending
+@pytest.mark.skipif(cffi is None, reason="requires cffi")
+def test_cffi():
+ from numpy.random._examples.cffi import extending