From a6a09198404899d4d4f672cbab366b36a903249f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 14 Oct 2020 21:27:04 -0400 Subject: [PATCH] Mark xarray shading test fail for GMT<=6.1.1 (#649) The xarray shading issue in #364 was fixed by upstream GMT in GenericMappingTools/gmt#4328. This PR updates the pytest xfail condition so that the xarray shading test is expected to xfail only for GMT<=6.1.1. --- pygmt/tests/test_grdimage.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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): """