From b8eebf56c090153ba5b5d0b948d85343f1a2a886 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Tue, 27 Jan 2026 13:02:22 +1000 Subject: [PATCH 1/2] add return fig to test --- ultraplot/tests/test_colorbar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ultraplot/tests/test_colorbar.py b/ultraplot/tests/test_colorbar.py index 47ec5f246..3a268ed1c 100644 --- a/ultraplot/tests/test_colorbar.py +++ b/ultraplot/tests/test_colorbar.py @@ -168,6 +168,7 @@ def test_colorbar_log_formatter_no_tickrange_error(rng): m = ax.pcolormesh(data, cmap="magma", norm="log") ax.colorbar(m, formatter="log") fig.canvas.draw() + return fig @pytest.mark.mpl_image_compare From e5f8e3c971a7ecd332dfb7f2fab0450624b3d4dd Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Tue, 27 Jan 2026 14:49:17 +1000 Subject: [PATCH 2/2] CI: set default mpl image tolerance --- ultraplot/tests/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ultraplot/tests/conftest.py b/ultraplot/tests/conftest.py index f296ab9d1..8564a9163 100644 --- a/ultraplot/tests/conftest.py +++ b/ultraplot/tests/conftest.py @@ -89,3 +89,11 @@ def pytest_configure(config): config.pluginmanager.register(StoreFailedMplPlugin(config)) except Exception as e: print(f"Error during plugin configuration: {e}") + # Set a global default tolerance for mpl_image_compare unless overridden. + try: + if config.getoption("--mpl-default-tolerance") is None and not config.getini( + "mpl-default-tolerance" + ): + config.setini("mpl-default-tolerance", "3") + except Exception as e: + print(f"Error setting mpl default tolerance: {e}")