diff --git a/lib/matplotlib/tests/test_font_manager.py b/lib/matplotlib/tests/test_font_manager.py index 73571298de4f..add063df9066 100644 --- a/lib/matplotlib/tests/test_font_manager.py +++ b/lib/matplotlib/tests/test_font_manager.py @@ -286,6 +286,9 @@ def _model_handler(_): reason='emscripten does not support subprocesses') @pytest.mark.skipif(not hasattr(os, "register_at_fork"), reason="Cannot register at_fork handlers") +# Python 3.15+ raises DeprecationWarning for fork in multi-threaded process +@pytest.mark.filterwarnings("ignore:.*multi-threaded.*fork.*:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:.*multi-threaded.*fork.*:RuntimeWarning") def test_fork(): _model_handler(0) # Make sure the font cache is filled. ctx = multiprocessing.get_context("fork") diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index 0479fc7a02a8..22295f102a45 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -73,32 +73,34 @@ def func(): def test_RcParams_class(): - rc = mpl.RcParams({'font.cursive': ['Apple Chancery', - 'Textile', - 'Zapf Chancery', - 'cursive'], + rc = mpl.RcParams({'font.cursive': ['Zapf Chancery', 'cursive'], 'font.family': 'sans-serif', 'font.weight': 'normal', 'font.size': 12}) expected_repr = """ -RcParams({'font.cursive': ['Apple Chancery', - 'Textile', - 'Zapf Chancery', - 'cursive'], +RcParams({ + 'font.cursive': ['Zapf Chancery', 'cursive'], 'font.family': ['sans-serif'], 'font.size': 12.0, - 'font.weight': 'normal'})""".lstrip() + 'font.weight': 'normal', + })""".lstrip() - assert expected_repr == repr(rc) + actual_repr = repr(rc) + if sys.version_info[:2] < (3, 15): + actual_repr = (actual_repr + .replace("{'", "{\n '") + .replace("'}", "',\n }")) + + assert actual_repr == expected_repr expected_str = """ -font.cursive: ['Apple Chancery', 'Textile', 'Zapf Chancery', 'cursive'] +font.cursive: ['Zapf Chancery', 'cursive'] font.family: ['sans-serif'] font.size: 12.0 font.weight: normal""".lstrip() - assert expected_str == str(rc) + assert str(rc) == expected_str # test the find_all functionality assert ['font.cursive', 'font.size'] == sorted(rc.find_all('i[vz]'))