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

Skip to content

Make test suite fail on warnings. #14131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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])
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/tests/test_cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ python_files = test_*.py
markers =
backend: Set alternate Matplotlib backend temporarily.
style: Set alternate Matplotlib style temporarily.

filterwarnings =
error