From 742e86c6891ca715576dbe97f000998ad2f2249e Mon Sep 17 00:00:00 2001 From: Ishaan Desai Date: Mon, 30 Dec 2024 11:59:07 +0100 Subject: [PATCH] Add mock function of get_output_dir() --- tests/unit/test_adaptivity_parallel.py | 5 +++++ tests/unit/test_adaptivity_serial.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/unit/test_adaptivity_parallel.py b/tests/unit/test_adaptivity_parallel.py index 3db3294..25c01ab 100644 --- a/tests/unit/test_adaptivity_parallel.py +++ b/tests/unit/test_adaptivity_parallel.py @@ -30,6 +30,8 @@ def test_update_inactive_sims_global_adaptivity(self): configurator = MagicMock() configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1") + configurator.get_output_dir = MagicMock(return_value="output_dir") + adaptivity_controller = GlobalAdaptivityCalculator( configurator, 5, global_ids, rank=self._rank, comm=self._comm ) @@ -108,6 +110,7 @@ def test_update_all_active_sims_global_adaptivity(self): configurator.get_adaptivity_refining_const = MagicMock(return_value=0.05) configurator.get_adaptivity_coarsening_const = MagicMock(return_value=0.2) configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L2rel") + configurator.get_output_dir = MagicMock(return_value="output_dir") adaptivity_controller = GlobalAdaptivityCalculator( configurator, 5, global_ids, rank=self._rank, comm=self._comm @@ -175,6 +178,8 @@ def test_communicate_micro_output(self): configurator = MagicMock() configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1") + configurator.get_output_dir = MagicMock(return_value="output_dir") + adaptivity_controller = GlobalAdaptivityCalculator( configurator, 5, global_ids, rank=self._rank, comm=self._comm ) diff --git a/tests/unit/test_adaptivity_serial.py b/tests/unit/test_adaptivity_serial.py index de9e71b..6853c24 100644 --- a/tests/unit/test_adaptivity_serial.py +++ b/tests/unit/test_adaptivity_serial.py @@ -68,6 +68,8 @@ def test_get_similarity_dists(self): """ configurator = MagicMock() configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1") + configurator.get_output_dir = MagicMock(return_value="output_dir") + adaptivity_controller = AdaptivityCalculator(configurator, 0) adaptivity_controller._hist_param = 0.5 adaptivity_controller._adaptivity_data_names = [ @@ -102,6 +104,8 @@ def test_update_active_sims(self): """ configurator = MagicMock() configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1") + configurator.get_output_dir = MagicMock(return_value="output_dir") + adaptivity_controller = AdaptivityCalculator(configurator, 0) adaptivity_controller._refine_const = self._refine_const adaptivity_controller._coarse_const = self._coarse_const @@ -208,6 +212,8 @@ def test_associate_active_to_inactive(self): """ configurator = MagicMock() configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1") + configurator.get_output_dir = MagicMock(return_value="output_dir") + adaptivity_controller = AdaptivityCalculator(configurator, 0) adaptivity_controller._refine_const = self._refine_const adaptivity_controller._coarse_const = self._coarse_const @@ -235,6 +241,8 @@ def test_update_inactive_sims_local_adaptivity(self): """ configurator = MagicMock() configurator.get_adaptivity_similarity_measure = MagicMock(return_value="L1") + configurator.get_output_dir = MagicMock(return_value="output_dir") + adaptivity_controller = LocalAdaptivityCalculator( configurator, 0, MagicMock(), 5 )