Skip to content

Commit

Permalink
Protect against abuse by unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hwikle-lanl committed Feb 6, 2025
1 parent b00372a commit ef0841b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/pavilion/test_run/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,14 @@ def _finalize_complete_file(self, complete_path: Path, complete_tmp_path: Path,
"back on symlink to temporary file location.")

# Symlink with the expectation that the temp file will be there eventually
complete_path.symlink_to(complete_tmp_path)
try:
complete_path.symlink_to(complete_tmp_path)
except FileExistsError:
# This shouldn't happen during regular use, but happens during at least one
# unit test, so we still need to handle it.
status.set(STATES.WARNING, f"File {self.COMPLETE_FN} already exists. Test "
"appears to have been marked complete more than "
"once.")

self._complete = True

Expand Down

0 comments on commit ef0841b

Please sign in to comment.