From 7091e4c48ce7af8a5263b6808a6d7976d4af4c6f Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Mon, 23 Aug 2021 17:46:26 -0600 Subject: 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. --- numpy/_pytesttester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/_pytesttester.py') 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 -- cgit v1.2.1