summaryrefslogtreecommitdiff
path: root/numpy/_pytesttester.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-08-23 17:46:26 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-08-23 17:46:26 -0600
commit7091e4c48ce7af8a5263b6808a6d7976d4af4c6f (patch)
treed39ae9d6afa85cf3a30367740e7dd7a46990786c /numpy/_pytesttester.py
parent06ec0ec8dadf9e0e9f7518c9817b95f14df9d7be (diff)
downloadnumpy-7091e4c48ce7af8a5263b6808a6d7976d4af4c6f.tar.gz
Use catch_warnings(record=True) instead of simplefilter('ignore')
There is a test that fails in the presence of simplefilter('ignore') (test_warnings.py). catch_warnings(record=True) seems to be a way to get the same behavior without failing the test.
Diffstat (limited to 'numpy/_pytesttester.py')
-rw-r--r--numpy/_pytesttester.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/_pytesttester.py b/numpy/_pytesttester.py
index bfcbd4f1f..8decb9dd7 100644
--- a/numpy/_pytesttester.py
+++ b/numpy/_pytesttester.py
@@ -144,11 +144,11 @@ class PytestTester:
# 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.
- warnings.simplefilter("ignore")
import numpy.array_api
# Filter out annoying import messages. Want these in both develop and