diff --git a/pygmt/tests/test_datasets_earth_relief.py b/pygmt/tests/test_datasets_earth_relief.py index 6e65bde902d..c8c63050a63 100644 --- a/pygmt/tests/test_datasets_earth_relief.py +++ b/pygmt/tests/test_datasets_earth_relief.py @@ -4,6 +4,8 @@ import numpy as np import numpy.testing as npt import pytest +from packaging.version import Version +from pygmt.clib import __gmt_version__ from pygmt.datasets import load_earth_relief from pygmt.exceptions import GMTInvalidInput @@ -186,6 +188,10 @@ def test_earth_relief_15s_default_registration(): npt.assert_allclose(data.max(), -71, atol=0.5) +@pytest.mark.xfail( + condition=Version(__gmt_version__) >= Version("6.5.0"), + reason="Upstream bug tracked in https://github.com/GenericMappingTools/pygmt/issues/2511", +) def test_earth_relief_03s_default_registration(): """ Test that the grid returned by default for the 3 arc-second resolution has a @@ -198,5 +204,5 @@ def test_earth_relief_03s_default_registration(): npt.assert_allclose(data.coords["lat"].data.max(), 5) npt.assert_allclose(data.coords["lon"].data.min(), -10) npt.assert_allclose(data.coords["lon"].data.max(), -9.8) - npt.assert_allclose(data.min(), -2131.9, atol=0.5) + npt.assert_allclose(data.min(), -2069.85, atol=0.5) npt.assert_allclose(data.max(), -924.5, atol=0.5) diff --git a/pygmt/tests/test_datasets_load_remote_datasets.py b/pygmt/tests/test_datasets_load_remote_datasets.py index ee5e126a0de..3d68518f18d 100644 --- a/pygmt/tests/test_datasets_load_remote_datasets.py +++ b/pygmt/tests/test_datasets_load_remote_datasets.py @@ -2,6 +2,8 @@ Test the _load_remote_dataset function. """ import pytest +from packaging.version import Version +from pygmt.clib import __gmt_version__ from pygmt.datasets.load_remote_dataset import _load_remote_dataset from pygmt.exceptions import GMTInvalidInput @@ -27,11 +29,13 @@ def test_load_remote_dataset_benchmark_with_region(): data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5]) assert data.name == "seafloor_age" assert data.attrs["long_name"] == "age of seafloor crust" - assert data.attrs["cpt"] == "@earth_age.cpt" assert data.attrs["units"] == "Myr" assert data.attrs["horizontal_datum"] == "WGS84" assert data.gmt.registration == 0 assert data.shape == (11, 21) + # The cpt attribute was added since GMT 6.4.0 + if Version(__gmt_version__) >= Version("6.4.0"): + assert data.attrs["cpt"] == "@earth_age.cpt" def test_load_remote_dataset_invalid_resolutions(): diff --git a/pygmt/tests/test_x2sys_cross.py b/pygmt/tests/test_x2sys_cross.py index 7aa2e4653c0..af9c7ac8dcd 100644 --- a/pygmt/tests/test_x2sys_cross.py +++ b/pygmt/tests/test_x2sys_cross.py @@ -10,7 +10,9 @@ import numpy.testing as npt import pandas as pd import pytest +from packaging.version import Version from pygmt import x2sys_cross, x2sys_init +from pygmt.clib import __gmt_version__ from pygmt.datasets import load_sample_data from pygmt.exceptions import GMTInvalidInput from pygmt.helpers import data_kind @@ -55,6 +57,10 @@ def test_x2sys_cross_input_file_output_file(): @pytest.mark.usefixtures("mock_x2sys_home") +@pytest.mark.xfail( + condition=Version(__gmt_version__) < Version("6.5.0"), + reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188", +) def test_x2sys_cross_input_file_output_dataframe(): """ Run x2sys_cross by passing in a filename, and output internal crossovers to a @@ -196,6 +202,10 @@ def test_x2sys_cross_invalid_tracks_input_type(tracks): @pytest.mark.usefixtures("mock_x2sys_home") +@pytest.mark.xfail( + condition=Version(__gmt_version__) < Version("6.5.0"), + reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188", +) def test_x2sys_cross_region_interpolation_numpoints(): """ Test that x2sys_cross's region (R), interpolation (l) and numpoints (W) arguments @@ -221,6 +231,10 @@ def test_x2sys_cross_region_interpolation_numpoints(): @pytest.mark.usefixtures("mock_x2sys_home") +@pytest.mark.xfail( + condition=Version(__gmt_version__) < Version("6.5.0"), + reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188", +) def test_x2sys_cross_trackvalues(): """ Test that x2sys_cross's trackvalues (Z) argument work.