Removing pytest.warns(None)
@@ -3,6 +3,7 @@ import scipy as sp
from numpy.testing import assert_array_equal
import pytest
+import warnings
from sklearn.utils._testing import assert_allclose
@@ -44,9 +45,9 @@ def test_no_empty_slice_warning():
n_features = n_components + 2 # anything > n_comps triggered it in 0.16
X = np.random.uniform(-1, 1, size=(n_components, n_features))
pca = PCA(n_components=n_components)
- with pytest.warns(None) as record:
+ with warnings.catch_warnings():
+ warnings.simplefilter("error", RuntimeWarning)
pca.fit(X)
- assert not [w.message for w in record]
@pytest.mark.parametrize("copy", [True, False])
