Improve warning reporting in LARS test
diff --git a/sklearn/linear_model/tests/test_least_angle.py b/sklearn/linear_model/tests/test_least_angle.py
index 4dc69f63ee6ba..0644dcc864fed 100644
--- a/sklearn/linear_model/tests/test_least_angle.py
+++ b/sklearn/linear_model/tests/test_least_angle.py
@@ -451,16 +451,23 @@ def test_lars_cv():
     assert not hasattr(lars_cv, 'n_nonzero_coefs')
 
 
-@pytest.mark.filterwarnings('ignore::FutureWarning')
-def test_lars_cv_max_iter():
-    with warnings.catch_warnings(record=True) as w:
+def test_lars_cv_max_iter(recwarn):
+    warnings.simplefilter('always')
+    with np.errstate(divide='raise', invalid='raise'):
+        X = diabetes.data
+        y = diabetes.target
         rng = np.random.RandomState(42)
         x = rng.randn(len(y))
         X = diabetes.data
         X = np.c_[X, x, x]  # add correlated features
-        lars_cv = linear_model.LassoLarsCV(max_iter=5)
+        lars_cv = linear_model.LassoLarsCV(max_iter=5, cv=5)
         lars_cv.fit(X, y)
-    assert len(w) == 0
+    # Check that there is no warning in general and no ConvergenceWarning
+    # in particular.
+    # Materialize the string representation of the warning to get a more
+    # informative error message in case of AssertionError.
+    recorded_warnings = [str(w) for w in recwarn]
+    assert recorded_warnings == []
 
 
 def test_lasso_lars_ic():

This should improve the error message for the failures reported on the Debian AMD64 continuous integration (see #12548).