diff --git a/pygmt/tests/baseline/test_grd2cpt.png.dvc b/pygmt/tests/baseline/test_grd2cpt.png.dvc new file mode 100644 index 00000000000..7e226749ada --- /dev/null +++ b/pygmt/tests/baseline/test_grd2cpt.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 0848349770986ef56d740e866ab961bc + size: 24843 + path: test_grd2cpt.png diff --git a/pygmt/tests/test_grd2cpt.py b/pygmt/tests/test_grd2cpt.py index 26a83cced36..59c1e4b7f42 100644 --- a/pygmt/tests/test_grd2cpt.py +++ b/pygmt/tests/test_grd2cpt.py @@ -4,12 +4,10 @@ import os import pytest -from pygmt import Figure +from pygmt import Figure, grd2cpt from pygmt.datasets import load_earth_relief from pygmt.exceptions import GMTInvalidInput from pygmt.helpers import GMTTempFile -from pygmt.helpers.testing import check_figures_equal -from pygmt.src.grd2cpt import grd2cpt @pytest.fixture(scope="module", name="grid") @@ -20,21 +18,17 @@ def fixture_grid(): return load_earth_relief() -@check_figures_equal() +@pytest.mark.mpl_image_compare def test_grd2cpt(grid): """ Test creating a CPT with grd2cpt to create a CPT based off a grid input and plot it with a color bar. """ - fig_ref, fig_test = Figure(), Figure() - # Use single-character arguments for the reference image - fig_ref.basemap(B="a", J="W0/15c", R="d") - grd2cpt(grid="@earth_relief_01d") - fig_ref.colorbar(B="a2000") - fig_test.basemap(frame="a", projection="W0/15c", region="d") + fig = Figure() + fig.basemap(frame="a", projection="W0/15c", region="d") grd2cpt(grid=grid) - fig_test.colorbar(frame="a2000") - return fig_ref, fig_test + fig.colorbar(frame="a2000") + return fig def test_grd2cpt_blank_output(grid):