Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cd9194

Browse files
committed
Make test suite fail on warnings.
1 parent 4236b57 commit 0cd9194

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6073,7 +6073,8 @@ def invert(x):
60736073

60746074
secax(0.2, functions=(invert, invert))
60756075
secax(0.4, functions=(lambda x: 2 * x, lambda x: x / 2))
6076-
secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2)))
6076+
with pytest.warns(RuntimeWarning): # Needs to be fixed.
6077+
secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2)))
60776078
secax(0.8)
60786079

60796080

lib/matplotlib/tests/test_cbook.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,8 @@ def test_normalize_kwargs_pass(inp, expected, kwargs_to_norm):
353353
def test_warn_external_frame_embedded_python():
354354
with patch.object(cbook, "sys") as mock_sys:
355355
mock_sys._getframe = Mock(return_value=None)
356-
with warnings.catch_warnings(record=True) as w:
356+
with pytest.warns(UserWarning, match=r"\Adummy\Z"):
357357
cbook._warn_external("dummy")
358-
assert len(w) == 1
359-
assert str(w[0].message) == "dummy"
360358

361359

362360
def test_to_prestep():

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ python_files = test_*.py
77
markers =
88
backend: Set alternate Matplotlib backend temporarily.
99
style: Set alternate Matplotlib style temporarily.
10+
11+
filterwarnings =
12+
error

0 commit comments

Comments
 (0)