Skip to content

Commit 75ec6d0

Browse files
authored
Let all tests pass for GMT 6.1.1 and master (#668)
* Skip the xarray shading test on macOS * Mark two info tests xfail before the bug is fixed * Avoid checking undocumented status code
1 parent 3b4199a commit 75ec6d0

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

pygmt/tests/test_clib.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,8 @@ def test_call_module_error_message():
161161
try:
162162
lib.call_module("info", "bogus-data.bla")
163163
except GMTCLibError as error:
164-
msg = "\n".join(
165-
[
166-
"Module 'info' failed with status code 71:",
167-
"gmtinfo [ERROR]: Cannot find file bogus-data.bla",
168-
]
169-
)
170-
assert str(error) == msg
164+
assert "Module 'info' failed with status code" in str(error)
165+
assert "gmtinfo [ERROR]: Cannot find file bogus-data.bla" in str(error)
171166

172167

173168
def test_method_no_session():

pygmt/tests/test_grdimage.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Test Figure.grdimage
33
"""
4+
import sys
45
import numpy as np
56
import pytest
67
import xarray as xr
@@ -73,9 +74,9 @@ def test_grdimage_file():
7374
return fig
7475

7576

76-
@pytest.mark.xfail(
77+
@pytest.mark.skip(
7778
reason="Upstream bug in GMT 6.1.1",
78-
condition=gmt_version <= Version("6.1.1"),
79+
condition=gmt_version <= Version("6.1.1") and sys.platform == "darwin",
7980
)
8081
@check_figures_equal()
8182
@pytest.mark.parametrize(

pygmt/tests/test_info.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
import pandas as pd
99
import pytest
1010
import xarray as xr
11-
from packaging.version import Version
1211

13-
from .. import clib, info
12+
from .. import info
1413
from ..exceptions import GMTInvalidInput
1514

1615
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
1716
POINTS_DATA = os.path.join(TEST_DATA_DIR, "points.txt")
1817

19-
with clib.Session() as _lib:
20-
gmt_version = Version(_lib.info["version"])
21-
2218

2319
def test_info():
2420
"Make sure info works on file name inputs"
@@ -43,7 +39,6 @@ def test_info_dataframe():
4339

4440

4541
@pytest.mark.xfail(
46-
condition=gmt_version <= Version("6.1.1"),
4742
reason="UNIX timestamps returned instead of ISO datetime, should work on GMT 6.2.0 "
4843
"after https://github.com/GenericMappingTools/gmt/issues/4241 is resolved",
4944
)
@@ -63,7 +58,6 @@ def test_info_pandas_dataframe_time_column():
6358

6459

6560
@pytest.mark.xfail(
66-
condition=gmt_version <= Version("6.1.1"),
6761
reason="UNIX timestamp returned instead of ISO datetime, should work on GMT 6.2.0 "
6862
"after https://github.com/GenericMappingTools/gmt/issues/4241 is resolved",
6963
)

0 commit comments

Comments
 (0)