diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index dbc0f0928b74..6048b2647b17 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -660,7 +660,7 @@ def _test_figure_leak(): reason="appveyor tests fail; gh-22988 suggests reworking") @pytest.mark.parametrize("env", _get_testable_interactive_backends()) @pytest.mark.parametrize("time_mem", [(0.0, 2_000_000), (0.1, 30_000_000)]) -def test_figure_leak_20490(env, time_mem): +def test_figure_leak_20490(env, time_mem, request): pytest.importorskip("psutil", reason="psutil needed to run this test") # We haven't yet directly identified the leaks so test with a memory growth @@ -669,9 +669,10 @@ def test_figure_leak_20490(env, time_mem): if env["MPLBACKEND"] == "wx": pytest.skip("wx backend is deprecated; tests failed on appveyor") - if env["MPLBACKEND"] == "macosx" or ( - env["MPLBACKEND"] == "tkagg" and sys.platform == 'darwin' - ): + if env["MPLBACKEND"] == "macosx": + request.node.add_marker(pytest.mark.xfail(reason="macosx backend is leaky")) + + if env["MPLBACKEND"] == "tkagg" and sys.platform == "darwin": acceptable_memory_leakage += 11_000_000 result = _run_helper( @@ -815,12 +816,12 @@ def custom_signal_handler(signum, frame): ('show', {'block': True}), ('pause', {'interval': 10}) ]) -def test_other_signal_before_sigint(env, target, kwargs): +def test_other_signal_before_sigint(env, target, kwargs, request): backend = env.get("MPLBACKEND") if not backend.startswith(("qt", "macosx")): pytest.skip("SIGINT currently only tested on qt and macosx") - if backend == "macosx" and target == "show": - pytest.xfail("test currently failing for macosx + show()") + if backend == "macosx": + request.node.add_marker(pytest.mark.xfail(reason="macosx backend is buggy")) proc = _WaitForStringPopen( [sys.executable, "-c", inspect.getsource(_test_other_signal_before_sigint_impl) + diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 8d1e20b4cb93..e222a495e437 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -143,7 +143,7 @@ def test_pickle_load_from_subprocess(fig_test, fig_ref, tmp_path): proc = subprocess_run_helper( _pickle_load_subprocess, timeout=60, - extra_env={'PICKLE_FILE_PATH': str(fp)} + extra_env={'PICKLE_FILE_PATH': str(fp), 'MPLBACKEND': 'Agg'} ) loaded_fig = pickle.loads(ast.literal_eval(proc.stdout)) diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py index c95526ecf987..9d08e335dbdd 100644 --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -1640,22 +1640,36 @@ def test_latex(self, is_latex, usetex, expected): assert fmt.format_pct(50, 100) == expected -def test_locale_comma(): - currentLocale = locale.getlocale() +def _impl_locale_comma(): try: locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8') - ticks = mticker.ScalarFormatter(useMathText=True, useLocale=True) - fmt = '$\\mathdefault{%1.1f}$' - x = ticks._format_maybe_minus_and_locale(fmt, 0.5) - assert x == '$\\mathdefault{0{,}5}$' - # Do not change , in the format string - fmt = ',$\\mathdefault{,%1.1f},$' - x = ticks._format_maybe_minus_and_locale(fmt, 0.5) - assert x == ',$\\mathdefault{,0{,}5},$' except locale.Error: - pytest.skip("Locale de_DE.UTF-8 is not supported on this machine") - finally: - locale.setlocale(locale.LC_ALL, currentLocale) + print('SKIP: Locale de_DE.UTF-8 is not supported on this machine') + return + ticks = mticker.ScalarFormatter(useMathText=True, useLocale=True) + fmt = '$\\mathdefault{%1.1f}$' + x = ticks._format_maybe_minus_and_locale(fmt, 0.5) + assert x == '$\\mathdefault{0{,}5}$' + # Do not change , in the format string + fmt = ',$\\mathdefault{,%1.1f},$' + x = ticks._format_maybe_minus_and_locale(fmt, 0.5) + assert x == ',$\\mathdefault{,0{,}5},$' + + +def test_locale_comma(): + # On some systems/pytest versions, `pytest.skip` in an exception handler + # does not skip, but is treated as an exception, so directly running this + # test can incorrectly fail instead of skip. + # Instead, run this test in a subprocess, which avoids the problem, and the + # need to fix the locale after. + proc = mpl.testing.subprocess_run_helper(_impl_locale_comma, timeout=60, + extra_env={'MPLBACKEND': 'Agg'}) + skip_msg = next((line[len('SKIP:'):].strip() + for line in proc.stdout.splitlines() + if line.startswith('SKIP:')), + '') + if skip_msg: + pytest.skip(skip_msg) def test_majformatter_type(): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy