From 8806f6d01153caa3dc7e377627a5c07f2147dcba Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 18 Dec 2023 08:27:58 +1300 Subject: [PATCH] Move pytest import inside of skip_if_no function To fix the `ModuleNotFoundError: No module named 'pytest'` error in the cache_data.yaml GitHub Action. --- pygmt/helpers/testing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygmt/helpers/testing.py b/pygmt/helpers/testing.py index 9cc88f1076a..10c10f4c6d3 100644 --- a/pygmt/helpers/testing.py +++ b/pygmt/helpers/testing.py @@ -6,7 +6,6 @@ import os import string -import pytest from pygmt.exceptions import GMTImageComparisonFailure from pygmt.io import load_dataarray from pygmt.src import which @@ -272,6 +271,8 @@ def skip_if_no(package): A pytest.mark.skipif to use as either a test decorator or a parametrization mark. """ + import pytest + try: _ = importlib.import_module(name=package) has_package = True