diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index fea961a201ee..acc365d765d9 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -6079,7 +6079,8 @@ def invert(x): secax(0.2, functions=(invert, invert)) secax(0.4, functions=(lambda x: 2 * x, lambda x: x / 2)) - secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2))) + with pytest.warns(RuntimeWarning): # Needs to be fixed. + secax(0.6, functions=(lambda x: x**2, lambda x: x**(1/2))) secax(0.8) @@ -6101,7 +6102,8 @@ def invert(x): with np.errstate(divide='ignore'): return 1 / x - ax.secondary_xaxis('top', functions=(invert, invert)) + with pytest.warns(RuntimeWarning): # May need to be fixed. + ax.secondary_xaxis('top', functions=(invert, invert)) fig.canvas.draw() fig.set_size_inches((7, 4)) assert_allclose(ax.get_position().extents, [0.125, 0.1, 0.9, 0.9]) diff --git a/lib/matplotlib/tests/test_cbook.py b/lib/matplotlib/tests/test_cbook.py index 9d35b34c04b3..4dee3018760b 100644 --- a/lib/matplotlib/tests/test_cbook.py +++ b/lib/matplotlib/tests/test_cbook.py @@ -353,10 +353,8 @@ def test_normalize_kwargs_pass(inp, expected, kwargs_to_norm): def test_warn_external_frame_embedded_python(): with patch.object(cbook, "sys") as mock_sys: mock_sys._getframe = Mock(return_value=None) - with warnings.catch_warnings(record=True) as w: + with pytest.warns(UserWarning, match=r"\Adummy\Z"): cbook._warn_external("dummy") - assert len(w) == 1 - assert str(w[0].message) == "dummy" def test_to_prestep(): diff --git a/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py b/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py index b0cd571def80..2af218781300 100644 --- a/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py +++ b/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py @@ -121,12 +121,12 @@ def update_lim(self, axes): grid_finder.grid_locator2(lat_min, lat_max) if self.nth_coord == 0: - xx0 = np.full(self._line_num_points, self.value) + xx0 = np.full(self._line_num_points, self.value, type(self.value)) yy0 = np.linspace(lat_min, lat_max, self._line_num_points) xx, yy = grid_finder.transform_xy(xx0, yy0) elif self.nth_coord == 1: xx0 = np.linspace(lon_min, lon_max, self._line_num_points) - yy0 = np.full(self._line_num_points, self.value) + yy0 = np.full(self._line_num_points, self.value, type(self.value)) xx, yy = grid_finder.transform_xy(xx0, yy0) self.grid_info = { diff --git a/pytest.ini b/pytest.ini index 730bea97604e..117bd5517b19 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,3 +7,6 @@ python_files = test_*.py markers = backend: Set alternate Matplotlib backend temporarily. style: Set alternate Matplotlib style temporarily. + +filterwarnings = + error