Skip to content

Commit fccb45c

Browse files
authored
Temporarily expect failures for some grdcontour and grdview tests (#503)
Until we update the baseline png images properly, use pytest.mark.xfail to temporarily bypass 13 test failures on grdcontour and grdview.
1 parent 294aee8 commit fccb45c

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

pygmt/tests/test_grdcontour.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,27 @@
22
Test Figure.grdcontour
33
"""
44
import os
5+
from packaging.version import Version
56

67
import numpy as np
78
import pytest
89

9-
from .. import Figure
10+
from .. import Figure, clib
1011
from ..exceptions import GMTInvalidInput
1112
from ..datasets import load_earth_relief
1213

1314

1415
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
1516
TEST_CONTOUR_FILE = os.path.join(TEST_DATA_DIR, "contours.txt")
1617

18+
with clib.Session() as lib:
19+
gmt_version = Version(lib.info["version"])
1720

21+
22+
@pytest.mark.xfail(
23+
condition=gmt_version < Version("6.1.0"),
24+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
25+
)
1826
@pytest.mark.mpl_image_compare
1927
def test_grdcontour():
2028
"""Plot a contour image using an xarray grid
@@ -26,6 +34,10 @@ def test_grdcontour():
2634
return fig
2735

2836

37+
@pytest.mark.xfail(
38+
condition=gmt_version < Version("6.1.0"),
39+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
40+
)
2941
@pytest.mark.mpl_image_compare
3042
def test_grdcontour_labels():
3143
"""Plot a contour image using a xarray grid
@@ -44,6 +56,10 @@ def test_grdcontour_labels():
4456
return fig
4557

4658

59+
@pytest.mark.xfail(
60+
condition=gmt_version < Version("6.1.0"),
61+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
62+
)
4763
@pytest.mark.mpl_image_compare
4864
def test_grdcontour_slice():
4965
"Plot an contour image using an xarray grid that has been sliced"
@@ -68,6 +84,10 @@ def test_grdcontour_file():
6884
return fig
6985

7086

87+
@pytest.mark.xfail(
88+
condition=gmt_version < Version("6.1.0"),
89+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
90+
)
7191
@pytest.mark.mpl_image_compare
7292
def test_grdcontour_interval_file_full_opts():
7393
""" Plot based on external contour level file """

pygmt/tests/test_grdview.py

+42-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
Tests grdview
44
"""
55
import pytest
6+
from packaging.version import Version
67

7-
from .. import Figure, which
8+
from .. import Figure, clib, which
89
from ..datasets import load_earth_relief
910
from ..exceptions import GMTInvalidInput
1011
from ..helpers import data_kind
1112

13+
with clib.Session() as lib:
14+
gmt_version = Version(lib.info["version"])
15+
1216

1317
@pytest.fixture(scope="module")
1418
def grid():
@@ -62,6 +66,10 @@ def test_grdview_with_perspective(grid):
6266
return fig
6367

6468

69+
@pytest.mark.xfail(
70+
condition=gmt_version < Version("6.1.0"),
71+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
72+
)
6573
@pytest.mark.mpl_image_compare
6674
def test_grdview_with_perspective_and_zscale(grid):
6775
"""
@@ -74,6 +82,10 @@ def test_grdview_with_perspective_and_zscale(grid):
7482
return fig
7583

7684

85+
@pytest.mark.xfail(
86+
condition=gmt_version < Version("6.1.0"),
87+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
88+
)
7789
@pytest.mark.mpl_image_compare
7890
def test_grdview_with_perspective_and_zsize(grid):
7991
"""
@@ -97,6 +109,10 @@ def test_grdview_with_cmap_for_image_plot(grid):
97109
return fig
98110

99111

112+
@pytest.mark.xfail(
113+
condition=gmt_version < Version("6.1.0"),
114+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
115+
)
100116
@pytest.mark.mpl_image_compare
101117
def test_grdview_with_cmap_for_surface_monochrome_plot(grid):
102118
"""
@@ -108,6 +124,10 @@ def test_grdview_with_cmap_for_surface_monochrome_plot(grid):
108124
return fig
109125

110126

127+
@pytest.mark.xfail(
128+
condition=gmt_version < Version("6.1.0"),
129+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
130+
)
111131
@pytest.mark.mpl_image_compare
112132
def test_grdview_with_cmap_for_perspective_surface_plot(grid):
113133
"""
@@ -116,11 +136,15 @@ def test_grdview_with_cmap_for_perspective_surface_plot(grid):
116136
"""
117137
fig = Figure()
118138
fig.grdview(
119-
grid=grid, cmap="oleron", surftype="s", perspective=[225, 30], zscale=0.005,
139+
grid=grid, cmap="oleron", surftype="s", perspective=[225, 30], zscale=0.005
120140
)
121141
return fig
122142

123143

144+
@pytest.mark.xfail(
145+
condition=gmt_version < Version("6.1.0"),
146+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
147+
)
124148
@pytest.mark.mpl_image_compare
125149
def test_grdview_on_a_plane(grid):
126150
"""
@@ -132,6 +156,10 @@ def test_grdview_on_a_plane(grid):
132156
return fig
133157

134158

159+
@pytest.mark.xfail(
160+
condition=gmt_version < Version("6.1.0"),
161+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
162+
)
135163
@pytest.mark.mpl_image_compare
136164
def test_grdview_on_a_plane_with_colored_frontal_facade(grid):
137165
"""
@@ -143,6 +171,10 @@ def test_grdview_on_a_plane_with_colored_frontal_facade(grid):
143171
return fig
144172

145173

174+
@pytest.mark.xfail(
175+
condition=gmt_version < Version("6.1.0"),
176+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
177+
)
146178
@pytest.mark.mpl_image_compare
147179
def test_grdview_with_perspective_and_zaxis_frame(grid):
148180
"""
@@ -154,6 +186,10 @@ def test_grdview_with_perspective_and_zaxis_frame(grid):
154186
return fig
155187

156188

189+
@pytest.mark.xfail(
190+
condition=gmt_version < Version("6.1.0"),
191+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
192+
)
157193
@pytest.mark.mpl_image_compare
158194
def test_grdview_surface_plot_styled_with_contourpen(grid):
159195
"""
@@ -176,6 +212,10 @@ def test_grdview_surface_mesh_plot_styled_with_meshpen(grid):
176212
return fig
177213

178214

215+
@pytest.mark.xfail(
216+
condition=gmt_version < Version("6.1.0"),
217+
reason="Baseline image not updated to use earth relief grid in GMT 6.1.0",
218+
)
179219
@pytest.mark.mpl_image_compare
180220
def test_grdview_on_a_plane_styled_with_facadepen(grid):
181221
"""

0 commit comments

Comments
 (0)