diff --git a/tests/unit/test_adapter_core.py b/tests/unit/test_adapter_core.py index 8775562e..47e0a16c 100644 --- a/tests/unit/test_adapter_core.py +++ b/tests/unit/test_adapter_core.py @@ -1,9 +1,11 @@ -from unittest.mock import MagicMock +from unittest.mock import MagicMock, patch from unittest import TestCase +from tests import MockedPrecice import numpy as np from fenics import FunctionSpace, VectorFunctionSpace, UnitSquareMesh, SubDomain, near, vertices, Expression, interpolate +@patch.dict('sys.modules', {'precice': MockedPrecice}) class TestAdapterCore(TestCase): def test_get_coupling_boundary_edges(self): """ diff --git a/tests/unit/test_checkpointing.py b/tests/unit/test_checkpointing.py index 594e2990..9c609243 100644 --- a/tests/unit/test_checkpointing.py +++ b/tests/unit/test_checkpointing.py @@ -1,14 +1,17 @@ -from unittest.mock import MagicMock +from unittest.mock import MagicMock, patch from unittest import TestCase +from tests import MockedPrecice from fenics import FunctionSpace, UnitSquareMesh, Expression, interpolate -from fenicsprecice.solverstate import SolverState +@patch.dict('sys.modules', {'precice': MockedPrecice}) class TestCheckpointing(TestCase): def test_solverstate_basic(self): """ Check if correct values are read from the checkpoint, while the state of the object that is copied is not changed """ + from fenicsprecice.solverstate import SolverState + n = 1 size = 5 mesh = UnitSquareMesh(size, size) @@ -37,6 +40,8 @@ def test_solverstate_modification_vector(self): Motivation for this test: Related to https://github.com/precice/fenics-adapter/pull/172 and https://github.com/precice/tutorials/pull/554 """ + from fenicsprecice.solverstate import SolverState + n = 1 size = 5 mesh = UnitSquareMesh(size, size) @@ -67,6 +72,8 @@ def test_solverstate_modification_assign(self): Check if correct values are read from the checkpoint, if the dof of the dolfin functions are changed with the assign function and not directly via the dof vector """ + from fenicsprecice.solverstate import SolverState + n = 1 size = 5 mesh = UnitSquareMesh(size, size)