From b96f652f9fc88ea2cf4fdbbad4bd3a7a15e83800 Mon Sep 17 00:00:00 2001 From: lukas leufen <l.leufen@fz-juelich.de> Date: Mon, 24 Aug 2020 13:00:33 +0200 Subject: [PATCH] better test cleanup --- test/test_run_modules/test_partition_check.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_run_modules/test_partition_check.py b/test/test_run_modules/test_partition_check.py index 1e576a8c..ba5b3d7e 100644 --- a/test/test_run_modules/test_partition_check.py +++ b/test/test_run_modules/test_partition_check.py @@ -5,7 +5,6 @@ import mock from mlair.run_modules.experiment_setup import ExperimentSetup from mlair.run_modules.partition_check import PartitionCheck from mlair.run_modules.run_environment import RunEnvironment -from mlair.configuration import get_host class TestPartitionCheck: @@ -24,6 +23,7 @@ class TestPartitionCheck: @mock.patch("os.path.exists", return_value=False) @mock.patch("os.makedirs", side_effect=None) def obj_with_exp_setup_login(self, mock_host, mock_user, mock_path, mock_check): + RunEnvironment().__del__() ExperimentSetup(stations=['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087', 'DEBW001'], statistics_per_var={'o3': 'dma8eu', 'temp': 'maximum'}, station_type="background") pre = object.__new__(PartitionCheck) @@ -37,6 +37,7 @@ class TestPartitionCheck: @mock.patch("os.path.exists", return_value=False) @mock.patch("os.makedirs", side_effect=None) def obj_with_exp_setup_compute(self, mock_host, mock_user, mock_path, mock_check): + RunEnvironment().__del__() ExperimentSetup(stations=['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087', 'DEBW001'], statistics_per_var={'o3': 'dma8eu', 'temp': 'maximum'}, station_type="background") pre = object.__new__(PartitionCheck) @@ -71,5 +72,5 @@ class TestPartitionCheck: @mock.patch("os.path.exists", return_value=False) @mock.patch("os.makedirs", side_effect=None) def test_run_compute(self, mock_host, mock_user, mock_path, mock_check, obj_with_exp_setup_compute, caplog): - - assert obj_with_exp_setup_compute.__next__()._run() is None + obj = obj_with_exp_setup_compute.__next__() + assert obj._run() is None -- GitLab