Skip to content

Commit

Permalink
Merge pull request #290 from ecmwf-ifs/nabr-fix-pytest-dependency
Browse files Browse the repository at this point in the history
[Bugfix] available_frontends: Import pytest locally to make dependency optional
  • Loading branch information
reuterbal authored Apr 16, 2024
2 parents 4068b82 + 953fa77 commit a68709b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions loki/frontend/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
import codecs
from codetiming import Timer
from more_itertools import split_after
import pytest

from loki.ir import (
NestedTransformer, FindNodes, PatternFinder, Transformer,
Assignment, Comment, CommentBlock, VariableDeclaration,
ProcedureDeclaration, Loop, Intrinsic, Pragma
)
from loki.frontend.source import join_source_list
from loki.logging import warning, perf
from loki.logging import warning, perf, error
from loki.tools import group_by_class, replace_windowed, as_tuple


Expand Down Expand Up @@ -92,6 +91,12 @@ def my_test(frontend):
else:
skip = {}

try:
import pytest # pylint: disable=import-outside-toplevel
except ImportError as e:
error('Pytest is not installed.')
raise e

from loki import frontend # pylint: disable=import-outside-toplevel,cyclic-import

# Unavailable frontends
Expand Down

0 comments on commit a68709b

Please sign in to comment.