8000 TST Replace pytest.warns(None) in test_omp.py (#22886) · scikit-learn/scikit-learn@aee564c · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aee564c

Browse files
authored
TST Replace pytest.warns(None) in test_omp.py (#22886)
1 parent 0b2f4ea commit aee564c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sklearn/linear_model/tests/test_omp.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import numpy as np
55
import pytest
6+
import warnings
67

78
from sklearn.utils._testing import assert_allclose
89
from sklearn.utils._testing import assert_array_equal
@@ -53,11 +54,11 @@ def test_assure_warning_when_normalize(OmpModel, normalize, n_warnings):
5354
y = rng.rand(n_samples)
5455

5556
model = OmpModel(normalize=normalize)
56-
with pytest.warns(None) as record:
57+
with warnings.catch_warnings(record=True) as rec:
58+
warnings.simplefilter("always", FutureWarning)
5759
model.fit(X, y)
5860

59-
record = [r for r in record if r.category == FutureWarning]
60-
assert len(record) == n_warnings
61+
assert len([w.message for w in rec]) == n_warnings
6162

6263

6364
def test_correct_shapes():

0 commit comments

Comments
 (0)
0