summaryrefslogtreecommitdiff
path: root/numpy/_pytesttester.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/_pytesttester.py')
-rw-r--r--numpy/_pytesttester.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/numpy/_pytesttester.py b/numpy/_pytesttester.py
index 1c32367f3..01ddaaf98 100644
--- a/numpy/_pytesttester.py
+++ b/numpy/_pytesttester.py
@@ -6,7 +6,7 @@ boiler plate for doing that is to put the following in the module
``__init__.py`` file::
from numpy._pytesttester import PytestTester
- test = PytestTester(__name__).test
+ test = PytestTester(__name__)
del PytestTester
@@ -33,28 +33,14 @@ import os
__all__ = ['PytestTester']
-
def _show_numpy_info():
- from numpy.core._multiarray_umath import (
- __cpu_features__, __cpu_baseline__, __cpu_dispatch__
- )
import numpy as np
print("NumPy version %s" % np.__version__)
relaxed_strides = np.ones((10, 1), order="C").flags.f_contiguous
print("NumPy relaxed strides checking option:", relaxed_strides)
-
- if len(__cpu_baseline__) == 0 and len(__cpu_dispatch__) == 0:
- enabled_features = "nothing enabled"
- else:
- enabled_features = ' '.join(__cpu_baseline__)
- for feature in __cpu_dispatch__:
- if __cpu_features__[feature]:
- enabled_features += " %s*" % feature
- else:
- enabled_features += " %s?" % feature
- print("NumPy CPU features:", enabled_features)
-
+ info = np.lib.utils._opt_info()
+ print("NumPy CPU features: ", (info if info else 'nothing enabled'))
class PytestTester:
@@ -149,13 +135,20 @@ class PytestTester:
# offset verbosity. The "-q" cancels a "-v".
pytest_args += ["-q"]
- # Filter out distutils cpu warnings (could be localized to
- # distutils tests). ASV has problems with top level import,
- # so fetch module for suppression here.
with warnings.catch_warnings():
warnings.simplefilter("always")
+ # Filter out distutils cpu warnings (could be localized to
+ # distutils tests). ASV has problems with top level import,
+ # so fetch module for suppression here.
from numpy.distutils import cpuinfo
+ with warnings.catch_warnings(record=True):
+ # Ignore the warning from importing the array_api submodule. This
+ # warning is done on import, so it would break pytest collection,
+ # but importing it early here prevents the warning from being
+ # issued when it imported again.
+ import numpy.array_api
+
# Filter out annoying import messages. Want these in both develop and
# release mode.
pytest_args += [
@@ -172,7 +165,7 @@ class PytestTester:
]
if doctests:
- raise ValueError("Doctests not supported")
+ pytest_args += ["--doctest-modules"]
if extra_argv:
pytest_args += list(extra_argv)
@@ -202,7 +195,6 @@ class PytestTester:
pytest_args += ["--pyargs"] + list(tests)
-
# run tests.
_show_numpy_info()