Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastiaan Huber <[email protected]>
  • Loading branch information
agoscinski and sphuber authored May 27, 2024
1 parent 5ff5655 commit 1db2b6f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/cmdline/commands/test_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,18 +527,17 @@ def test_computer_export_setup(self, tmp_path, sort):
result = self.cli_runner(computer_export_setup, [sort, comp.label, exported_setup_filename])
assert result.exit_code == 0, 'Command should have run successfull.'
assert f'{exported_setup_filename}' in result.output, 'Filename should be in terminal output but was not found.'
assert os.path.exists(exported_setup_filename), f"'{exported_setup_filename}' was not created during export."
assert exported_setup_filename.exists(), f"'{exported_setup_filename}' was not created during export."
# verifying correctness by comparing internal and loaded yml object
with open(exported_setup_filename, 'r', encoding='utf-8') as yfhandle:
configure_setup_data = yaml.safe_load(yfhandle)
configure_setup_data = yaml.safe_load(exported_setup_filename.read_text())
assert configure_setup_data == self.comp_builder.get_computer_spec(
comp
), 'Internal computer configuration does not agree with exported one.'

# we create a directory so we raise an error when exporting with the same name
# to test the except part of the function
already_existing_filename = tmp_path / 'tmp_dir'
os.mkdir(already_existing_filename)
already_existing_filename.mkdir()
result = self.cli_runner(computer_export_setup, [sort, comp.label, already_existing_filename], raises=True)
assert result.exit_code == ExitCode.CRITICAL

Expand Down

0 comments on commit 1db2b6f

Please sign in to comment.