diff --git a/pygmt/tests/test_grdimage.py b/pygmt/tests/test_grdimage.py index 8b9fac9acd8..c4658dc38e7 100644 --- a/pygmt/tests/test_grdimage.py +++ b/pygmt/tests/test_grdimage.py @@ -4,12 +4,16 @@ import numpy as np import pytest import xarray as xr +from packaging.version import Version -from .. import Figure +from .. import Figure, clib from ..datasets import load_earth_relief from ..exceptions import GMTInvalidInput from ..helpers.testing import check_figures_equal +with clib.Session() as _lib: + gmt_version = Version(_lib.info["version"]) + @pytest.fixture(scope="module", name="grid") def fixture_grid(): @@ -69,7 +73,10 @@ def test_grdimage_file(): return fig -@pytest.mark.xfail(reason="Upstream bug in GMT 6.1.1") +@pytest.mark.xfail( + reason="Upstream bug in GMT 6.1.1", + condition=gmt_version <= Version("6.1.1"), +) @check_figures_equal() def test_grdimage_xarray_shading(grid): """