Skip to content

Commit

Permalink
Merge pull request #315 from ecmwf-ifs/nabr-fix-f90wrap
Browse files Browse the repository at this point in the history
Compatibility with f90wrap v0.2.14
  • Loading branch information
reuterbal authored May 10, 2024
2 parents 5db17e5 + b4decea commit 5300280
Show file tree
Hide file tree
Showing 25 changed files with 515 additions and 794 deletions.
17 changes: 5 additions & 12 deletions loki/batch/tests/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pytest

from loki import (
Sourcefile, Subroutine, as_tuple, gettempdir, RawSource, TypeDef,
Sourcefile, Subroutine, as_tuple, RawSource, TypeDef,
Scalar, ProcedureSymbol
)
from loki.batch import (
Expand Down Expand Up @@ -632,7 +632,7 @@ def test_procedure_item_with_config2(testdir, disable):


@pytest.mark.parametrize('enable_imports', [False, True])
def test_procedure_item_external_item(enable_imports, default_config):
def test_procedure_item_external_item(tmp_path, enable_imports, default_config):
"""
Test that dependencies to external module procedures are marked as external item
"""
Expand All @@ -647,9 +647,7 @@ def test_procedure_item_external_item(enable_imports, default_config):
my_type%my_val = external_var
end subroutine procedure_item_external_item
"""
workdir = gettempdir()/'test_procedure_item_external_item'
workdir.mkdir(exist_ok=True)
filepath = workdir/'procedure_item_external_item.F90'
filepath = tmp_path/'procedure_item_external_item.F90'
filepath.write_text(fcode)

default_config['default']['enable_imports'] = enable_imports
Expand All @@ -671,9 +669,6 @@ def test_procedure_item_external_item(enable_imports, default_config):
assert all(isinstance(it, ExternalItem) for it in items)
assert [it.origin_cls for it in items] == [ModuleItem, ProcedureItem]

filepath.unlink(missing_ok=True)
workdir.rmdir()


def test_typedef_item(testdir):
proj = testdir/'sources/projBatch'
Expand Down Expand Up @@ -1000,7 +995,7 @@ def test_item_graph(testdir, comp1_expected_dependencies):
# Not fully-qualified procedure name for a module procedure
('mod_proc', 'mod_proc_expected_dependencies'),
])
def test_sgraph_from_seed(testdir, default_config, seed, dependencies_fixture, request):
def test_sgraph_from_seed(tmp_path, testdir, default_config, seed, dependencies_fixture, request):
expected_dependencies = request.getfixturevalue(dependencies_fixture)
proj = testdir/'sources/projBatch'
suffixes = ['.f90', '.F90']
Expand Down Expand Up @@ -1036,7 +1031,7 @@ def test_sgraph_from_seed(testdir, default_config, seed, dependencies_fixture, r
}

# Check the graph visualization
graph_file = gettempdir()/'sgraph_from_seed.dot'
graph_file = tmp_path/'sgraph_from_seed.dot'
sgraph.export_to_file(graph_file)
assert graph_file.exists()
assert graph_file.with_suffix('.dot.pdf').exists()
Expand All @@ -1048,8 +1043,6 @@ def test_sgraph_from_seed(testdir, default_config, seed, dependencies_fixture, r
for node, dependencies in expected_dependencies.items()
for dependency in dependencies
}
graph_file.unlink()
graph_file.with_suffix('.dot.pdf').unlink()


@pytest.mark.parametrize('seed,disable,active_nodes', [
Expand Down
Loading

0 comments on commit 5300280

Please sign in to comment.