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

Prepare for Pytest v8 #27624

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 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions 4 lib/matplotlib/tests/test_backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io
import os
from pathlib import Path
import warnings

import numpy as np
import pytest
Expand Down Expand Up @@ -84,6 +85,9 @@ def test_multipage_keep_empty(tmp_path):
os.chdir(tmp_path)

# test empty pdf files
# Due to order of `with` block execution, a warning for unclosed file is raised
# but the pytest.warns must happen before the PdfPages is created
warnings.filterwarnings("ignore", category=ResourceWarning)

# an empty pdf is left behind with keep_empty unset
with pytest.warns(mpl.MatplotlibDeprecationWarning), PdfPages("a.pdf") as pdf:
Expand Down
3 changes: 1 addition & 2 deletions 3 lib/matplotlib/tests/test_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ def test_double_register_builtin_cmap():
with pytest.raises(ValueError, match='A colormap named "viridis"'):
with pytest.warns(mpl.MatplotlibDeprecationWarning):
cm.register_cmap(name, mpl.colormaps[name])
with pytest.warns(UserWarning):
# TODO is warning more than once!
with pytest.warns(UserWarning), pytest.warns(mpl.MatplotlibDeprecationWarning):
cm.register_cmap(name, mpl.colormaps[name], override_builtin=True)


Expand Down
6 changes: 2 additions & 4 deletions 6 lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,12 @@ def test_rcparams_update():
rc = mpl.RcParams({'figure.figsize': (3.5, 42)})
bad_dict = {'figure.figsize': (3.5, 42, 1)}
# make sure validation happens on input
with pytest.raises(ValueError), \
pytest.warns(UserWarning, match="validate"):
with pytest.raises(ValueError):
rc.update(bad_dict)


def test_rcparams_init():
with pytest.raises(ValueError), \
pytest.warns(UserWarning, match="validate"):
with pytest.raises(ValueError):
mpl.RcParams({'figure.figsize': (3.5, 42, 1)})


Expand Down
4 changes: 4 additions & 0 deletions 4 lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import locale
import logging
import re
import warnings

import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
Expand Down Expand Up @@ -914,6 +915,9 @@ def test_mathtext_ticks(self):
'axes.formatter.use_mathtext': False
})

# Glyph warning unrelated
warnings.filterwarnings("ignore", category=UserWarning, message="Glyph 8722")

with pytest.warns(UserWarning, match='cmr10 font should ideally'):
fig, ax = plt.subplots()
ax.set_xticks([-1, 0, 1])
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.