Skip to content

Commit 69af355

Browse files
committed
FIX only use testing.ignore_warnings in tests
1 parent 22cafa6 commit 69af355

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/utils/fixes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
# License: BSD 3 clause
1212

1313
import inspect
14+
import warnings
1415

1516
import numpy as np
1617
import scipy.sparse as sp
1718

18-
from .testing import ignore_warnings
19-
2019
np_version = []
2120
for x in np.__version__.split('.'):
2221
try:
@@ -103,9 +102,10 @@ def astype(array, dtype, copy=True):
103102

104103

105104
try:
106-
with ignore_warnings():
105+
with warnings.catch_warnings(record=True):
107106
# Don't raise the numpy deprecation warnings that appear in
108-
# 1.9
107+
# 1.9, but avoid Python bug due to simplefilter('ignore')
108+
warnings.simplefilter('always')
109109
sp.csr_matrix([1.0, 2.0, 3.0]).max(axis=0)
110110
except (TypeError, AttributeError):
111111
# in scipy < 14.0, sparse matrix min/max doesn't accept an `axis` argument

0 commit comments

Comments
 (0)