From 1b5b2dcf412da04d02ad30aef025d71fada4068e Mon Sep 17 00:00:00 2001 From: Thomas Baumann <39156931+brownbaerchen@users.noreply.github.com> Date: Tue, 27 May 2025 17:35:11 +0200 Subject: [PATCH] Make plot helper compatible with Python 3.13 (#549) --- pySDC/helpers/plot_helper.py | 6 +++--- pySDC/tests/test_benchmarks/test_collocation.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pySDC/helpers/plot_helper.py b/pySDC/helpers/plot_helper.py index f1a6238dc..608f367c4 100644 --- a/pySDC/helpers/plot_helper.py +++ b/pySDC/helpers/plot_helper.py @@ -1,6 +1,6 @@ import matplotlib as mpl import matplotlib.pyplot as plt -from distutils.spawn import find_executable +import shutil default_mpl_params = mpl.rcParams.copy() @@ -100,7 +100,7 @@ def setup_mpl(font_size=8, reset=False): mpl.rcParams.update(style_options) - if find_executable('latex'): + if shutil.which('latex'): latex_support = { "pgf.texsystem": "pdflatex", # change this if using xetex or lautex "text.usetex": True, # use LaTeX to write all text @@ -125,7 +125,7 @@ def newfig(textwidth, scale, ratio=0.6180339887): def savefig(filename, save_pdf=True, save_pgf=True, save_png=True): - if save_pgf and find_executable('latex'): + if save_pgf and shutil.which('latex'): plt.savefig('{}.pgf'.format(filename), bbox_inches='tight') if save_pdf: plt.savefig('{}.pdf'.format(filename), bbox_inches='tight') diff --git a/pySDC/tests/test_benchmarks/test_collocation.py b/pySDC/tests/test_benchmarks/test_collocation.py index 2d6963e37..94d1f548f 100644 --- a/pySDC/tests/test_benchmarks/test_collocation.py +++ b/pySDC/tests/test_benchmarks/test_collocation.py @@ -25,6 +25,7 @@ def test_benchmark_collocation(benchmark): benchmark(wrapper) +@pytest.mark.base @pytest.mark.parametrize("node_type", node_types) @pytest.mark.parametrize("quad_type", quad_types) def test_canintegratepolynomials(node_type, quad_type): @@ -61,6 +62,7 @@ def test_canintegratepolynomials(node_type, quad_type): ) +@pytest.mark.base @pytest.mark.parametrize("node_type", node_types) @pytest.mark.parametrize("quad_type", quad_types) def test_relateQandSmat(node_type, quad_type): @@ -82,6 +84,7 @@ def test_relateQandSmat(node_type, quad_type): ) +@pytest.mark.base @pytest.mark.parametrize("node_type", node_types) @pytest.mark.parametrize("quad_type", quad_types) def test_partialquadraturewithQ(node_type, quad_type): @@ -104,6 +107,7 @@ def test_partialquadraturewithQ(node_type, quad_type): ) +@pytest.mark.base @pytest.mark.parametrize("node_type", node_types) @pytest.mark.parametrize("quad_type", quad_types) def test_partialquadraturewithS(node_type, quad_type): -- GitLab