From 1a8ea6b34353b8456f0b0ef702ad5cb543bf8f35 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 3 Apr 2024 09:02:49 +0100 Subject: [PATCH] Revert "Make fixtures clean up even if the test fails" This reverts commit 176fe04e8d0fd00fb57b92c5f6838a6387917a71. --- tests/pytests/functional/modules/test_chocolatey.py | 8 +++----- .../functional/states/chocolatey/test_bootstrap.py | 12 ++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/pytests/functional/modules/test_chocolatey.py b/tests/pytests/functional/modules/test_chocolatey.py index 904026dd93e..d11cdf6cbed 100644 --- a/tests/pytests/functional/modules/test_chocolatey.py +++ b/tests/pytests/functional/modules/test_chocolatey.py @@ -3,7 +3,7 @@ import pytest from salt.exceptions import CommandExecutionError pytestmark = [ - pytest.mark.destructive_test, + pytest.mark.destructive, pytest.mark.skip_unless_on_windows, pytest.mark.slow_test, pytest.mark.windows_whitelisted, @@ -23,10 +23,8 @@ def clean(chocolatey): except CommandExecutionError: chocolatey_version = None assert chocolatey_version is None - try: - yield - finally: - chocolatey.unbootstrap() + yield + chocolatey.unbootstrap() def test_bootstrap(chocolatey, clean): diff --git a/tests/pytests/functional/states/chocolatey/test_bootstrap.py b/tests/pytests/functional/states/chocolatey/test_bootstrap.py index 6b6bc62f558..0d37d67c665 100644 --- a/tests/pytests/functional/states/chocolatey/test_bootstrap.py +++ b/tests/pytests/functional/states/chocolatey/test_bootstrap.py @@ -28,10 +28,8 @@ def clean(chocolatey_mod): except CommandExecutionError: chocolatey_version = None assert chocolatey_version is None - try: - yield - finally: - chocolatey_mod.unbootstrap() + yield + chocolatey_mod.unbootstrap() @pytest.fixture() @@ -42,10 +40,8 @@ def installed(chocolatey_mod): except CommandExecutionError: chocolatey_version = None assert chocolatey_version is not None - try: - yield - finally: - chocolatey_mod.unbootstrap() + yield + chocolatey_mod.unbootstrap() def test_bootstrapped(chocolatey, chocolatey_mod, clean):