Skip to content

Commit

Permalink
available_frontends: Import pytest locally to make dependency optional
Browse files Browse the repository at this point in the history
  • Loading branch information
reuterbal committed Apr 16, 2024
1 parent 4068b82 commit 953fa77
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 953fa77

Please sign in to comment.