Skip to content

Commit

Permalink
test: remove output exclusion to allow xpansion sensitivity (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle authored May 26, 2023
1 parent 38f6a1b commit 622bc22
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions antareslauncher/use_cases/launch/study_zipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def zip(self, study) -> StudyDTO:
return self._current_study

def _do_zip(self):
zipfile_path = self._current_study.path + "-" + getpass.getuser() + ".zip"
zipfile_path = f"{self._current_study.path}-{getpass.getuser()}.zip"
success = self.file_manager.zip_dir_excluding_subdir(
self._current_study.path, zipfile_path, None
)
Expand All @@ -36,11 +36,11 @@ def _do_zip(self):
def _display_failure_error(self):
self.display.show_error(
f'"{Path(self._current_study.path).name}": was not zipped',
__name__ + "." + __class__.__name__,
f"{__name__}.{__class__.__name__}",
)

def _display_success_message(self):
self.display.show_message(
f'"{Path(self._current_study.path).name}": was zipped',
__name__ + "." + __class__.__name__,
f"{__name__}.{__class__.__name__}",
)
8 changes: 3 additions & 5 deletions tests/unit/launcher/test_launch_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def test_with_one_study_the_compressor_is_called_once(self):
)
my_launcher.launch_all_studies()

zipfile_path = my_study.path + "-" + getpass.getuser() + ".zip"
zipfile_path = f"{my_study.path}-{getpass.getuser()}.zip"
file_manager.zip_dir_excluding_subdir.assert_called_once_with(
my_study.path, zipfile_path, "output"
my_study.path, zipfile_path, None
)

@pytest.mark.unit_test
Expand All @@ -119,9 +119,7 @@ def test_given_one_study_then_repo_is_called_to_save_the_study_with_updated_zip_
my_launcher.repo.save_study = mock.Mock()
my_launcher.launch_all_studies()
# then
expected_study.zipfile_path = (
expected_study.path + "-" + getpass.getuser() + ".zip"
)
expected_study.zipfile_path = f"{expected_study.path}-{getpass.getuser()}.zip"
second_call = my_launcher.repo.save_study.call_args_list[1]
first_argument = second_call[0][0]
assert first_argument.zip_is_sent
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/launcher/test_zipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_zip_study_show_message_if_zip_succeeds(self):

self.study_zipper.zip(study)

expected_message = f'"hello": was zipped'
expected_message = '"hello": was zipped'
self.display_mock.show_message.assert_called_once_with(
expected_message, mock.ANY
)
Expand All @@ -34,7 +34,7 @@ def test_zip_study_show_error_if_zip_fails(self):

new_study = self.study_zipper.zip(study)

expected_message = f'"hello": was not zipped'
expected_message = '"hello": was not zipped'
self.display_mock.show_error.assert_called_once_with(expected_message, mock.ANY)
assert new_study.zipfile_path == ""

Expand All @@ -60,8 +60,8 @@ def test_file_manager_is_called_if_zip_doesnt_exist(self):

new_study = self.study_zipper.zip(study)

expected_zipfile_path = study.path + "-" + getpass.getuser() + ".zip"
expected_zipfile_path = f"{study.path}-{getpass.getuser()}.zip"
self.file_manager.zip_dir_excluding_subdir.assert_called_once_with(
study_path, expected_zipfile_path, "output"
study_path, expected_zipfile_path, None
)
assert new_study.zipfile_path == expected_zipfile_path

0 comments on commit 622bc22

Please sign in to comment.