From a2558c757ab344af432c937b7bfeafaf1f7c751d Mon Sep 17 00:00:00 2001 From: FloraSauerbronn Date: Wed, 19 Jun 2024 16:01:52 -0300 Subject: [PATCH] Solving matplotlib problem --- tests/test_plotting.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_plotting.py b/tests/test_plotting.py index 24b1199..9738d2f 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -1,5 +1,9 @@ import pytest +import matplotlib +matplotlib.use('agg') # Use the 'agg' backend + import matplotlib.pyplot as plt +import numpy as np from pathlib import Path from gliderpy.plotting import plot_track, plot_transect from gliderpy.fetchers import GliderDataFetcher @@ -39,5 +43,6 @@ def test_plot_transect_multiple_figures(glider_data): def test_plot_transect_size(glider_data): # Generate the plot with a specific size fig, ax = plt.subplots(figsize=(15, 9)) - glider_data.plot_transect(var="temperature", ax=ax) - assert fig.get_size_inches() == pytest.approx([15., 9.]) \ No newline at end of file + glider_data.plot_transect(var="temperature") + np.testing.assert_array_equal(fig.get_size_inches(), np.array([15., 9.])) +