Skip to content

Commit

Permalink
Fix broad-exception-caught
Browse files Browse the repository at this point in the history
  • Loading branch information
joscao committed Sep 14, 2023
1 parent af9bc9d commit f972093
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_uid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
from pathlib import Path
from collections import defaultdict
import pytest
from fparser.two.utils import FortranSyntaxError
from loki import Sourcefile
from loki.visitors.visitor import Visitor
from loki.tools import is_iterable, as_tuple



@pytest.fixture(scope="module", name="here")
def fixture_here():
return Path(__file__).parent
Expand Down Expand Up @@ -56,16 +58,14 @@ def visit_tuple(self, o, **kwargs):

fortran_files = list(Path(".").rglob("*.[fF]90"))


@pytest.mark.parametrize("file", fortran_files)
def test_has_every_node_a_uid(here: Path, file: Path):
print(here, file)
try:
source = Sourcefile.from_file(file)
except Exception:
except FortranSyntaxError:
try:
source = Sourcefile.from_file(file, preprocess=True)
except Exception:
except FortranSyntaxError:
return # ignore if a file cannot be parsed

Checker().visit(source.ir)
Expand Down

0 comments on commit f972093

Please sign in to comment.