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 8b05b35

Browse filesBrowse files
authored
Merge pull request #14131 from anntzer/werror
Make test suite fail on warnings.
2 parents 09321e4 + 7e97aaa commit 8b05b35
Copy full SHA for 8b05b35

File tree

Expand file treeCollapse file tree

4 files changed

+10
-7
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+10
-7
lines changed

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6079,7 +6079,8 @@ def invert(x):
60796079

60806080
secax(0.2, functions=(invert, invert))
60816081
secax(0.4, functions=(lambda x: 2 * x, lambda x: x / 2))
6082-
secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2)))
6082+
with pytest.warns(RuntimeWarning): # Needs to be fixed.
6083+
secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2)))
60836084
secax(0.8)
60846085

60856086

@@ -6101,7 +6102,8 @@ def invert(x):
61016102
with np.errstate(divide='ignore'):
61026103
return 1 / x
61036104

6104-
ax.secondary_xaxis('top', functions=(invert, invert))
6105+
with pytest.warns(RuntimeWarning): # May need to be fixed.
6106+
ax.secondary_xaxis('top', functions=(invert, invert))
61056107
fig.canvas.draw()
61066108
fig.set_size_inches((7, 4))
61076109
assert_allclose(ax.get_position().extents, [0.125, 0.1, 0.9, 0.9])

‎lib/matplotlib/tests/test_cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_cbook.py
+1-3Lines 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():

‎lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ def update_lim(self, axes):
121121
grid_finder.grid_locator2(lat_min, lat_max)
122122

123123
if self.nth_coord == 0:
124-
xx0 = np.full(self._line_num_points, self.value)
124+
xx0 = np.full(self._line_num_points, self.value, type(self.value))
125125
yy0 = np.linspace(lat_min, lat_max, self._line_num_points)
126126
xx, yy = grid_finder.transform_xy(xx0, yy0)
127127
elif self.nth_coord == 1:
128128
xx0 = np.linspace(lon_min, lon_max, self._line_num_points)
129-
yy0 = np.full(self._line_num_points, self.value)
129+
yy0 = np.full(self._line_num_points, self.value, type(self.value))
130130
xx, yy = grid_finder.transform_xy(xx0, yy0)
131131

132132
self.grid_info = {

‎pytest.ini

Copy file name to clipboardExpand all lines: pytest.ini
+3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.