From 9da1f58f0f2890246440d0cb175ca42f6ef9910f Mon Sep 17 00:00:00 2001 From: miroslavpojer Date: Fri, 8 Nov 2024 16:32:31 +0100 Subject: [PATCH] - Test hardening for CI run. --- tests/test_version_tag_check_action.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_version_tag_check_action.py b/tests/test_version_tag_check_action.py index ab91313..4c3869f 100644 --- a/tests/test_version_tag_check_action.py +++ b/tests/test_version_tag_check_action.py @@ -74,7 +74,8 @@ def test_run_successful(mocker, tmp_path): } # Update os.environ with the test environment variables os.environ.update(env_vars) - os.remove("output.txt") + if os.path.exists("output.txt"): + os.remove("output.txt") # Mock sys.exit to prevent the test from exiting mock_exit = mocker.patch("sys.exit") @@ -115,7 +116,8 @@ def test_run_invalid_version_format(mocker, tmp_path, caplog): "INPUT_GITHUB_REPOSITORY": "owner/repo", } os.environ.update(env_vars) - os.remove("output.txt") + if os.path.exists("output.txt"): + os.remove("output.txt") # Mock sys.exit def mock_exit(code): @@ -154,7 +156,8 @@ def test_run_invalid_version_increment(mocker, tmp_path): "INPUT_GITHUB_REPOSITORY": "owner/repo", } os.environ.update(env_vars) - os.remove("output.txt") + if os.path.exists("output.txt"): + os.remove("output.txt") # Mock sys.exit mock_exit = mocker.patch("sys.exit")