Skip to content

Commit e96fa47

Browse files
Migrate pygmt.grd2cpt tests to use dvc (#1162)
Co-authored-by: Dongdong Tian <[email protected]>
1 parent 2893798 commit e96fa47

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 0848349770986ef56d740e866ab961bc
3+
size: 24843
4+
path: test_grd2cpt.png

pygmt/tests/test_grd2cpt.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
import os
55

66
import pytest
7-
from pygmt import Figure
7+
from pygmt import Figure, grd2cpt
88
from pygmt.datasets import load_earth_relief
99
from pygmt.exceptions import GMTInvalidInput
1010
from pygmt.helpers import GMTTempFile
11-
from pygmt.helpers.testing import check_figures_equal
12-
from pygmt.src.grd2cpt import grd2cpt
1311

1412

1513
@pytest.fixture(scope="module", name="grid")
@@ -20,21 +18,17 @@ def fixture_grid():
2018
return load_earth_relief()
2119

2220

23-
@check_figures_equal()
21+
@pytest.mark.mpl_image_compare
2422
def test_grd2cpt(grid):
2523
"""
2624
Test creating a CPT with grd2cpt to create a CPT based off a grid input and
2725
plot it with a color bar.
2826
"""
29-
fig_ref, fig_test = Figure(), Figure()
30-
# Use single-character arguments for the reference image
31-
fig_ref.basemap(B="a", J="W0/15c", R="d")
32-
grd2cpt(grid="@earth_relief_01d")
33-
fig_ref.colorbar(B="a2000")
34-
fig_test.basemap(frame="a", projection="W0/15c", region="d")
27+
fig = Figure()
28+
fig.basemap(frame="a", projection="W0/15c", region="d")
3529
grd2cpt(grid=grid)
36-
fig_test.colorbar(frame="a2000")
37-
return fig_ref, fig_test
30+
fig.colorbar(frame="a2000")
31+
return fig
3832

3933

4034
def test_grd2cpt_blank_output(grid):

0 commit comments

Comments
 (0)