Skip to content

Commit d1e8f2f

Browse files
authored
Move pytest import inside of skip_if_no function (#2891)
To fix the `ModuleNotFoundError: No module named 'pytest'` error in the cache_data.yaml GitHub Action.
1 parent 005de65 commit d1e8f2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pygmt/helpers/testing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import string
88

9-
import pytest
109
from pygmt.exceptions import GMTImageComparisonFailure
1110
from pygmt.io import load_dataarray
1211
from pygmt.src import which
@@ -272,6 +271,8 @@ def skip_if_no(package):
272271
A pytest.mark.skipif to use as either a test decorator or a
273272
parametrization mark.
274273
"""
274+
import pytest
275+
275276
try:
276277
_ = importlib.import_module(name=package)
277278
has_package = True

0 commit comments

Comments
 (0)