mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Make fixtures clean up even if the test fails
This commit is contained in:
parent
eb785bdf30
commit
176fe04e8d
2 changed files with 13 additions and 7 deletions
|
@ -3,7 +3,7 @@ import pytest
|
|||
from salt.exceptions import CommandExecutionError
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.destructive,
|
||||
pytest.mark.destructive_test,
|
||||
pytest.mark.skip_unless_on_windows,
|
||||
pytest.mark.slow_test,
|
||||
pytest.mark.windows_whitelisted,
|
||||
|
@ -23,8 +23,10 @@ def clean(chocolatey):
|
|||
except CommandExecutionError:
|
||||
chocolatey_version = None
|
||||
assert chocolatey_version is None
|
||||
yield
|
||||
chocolatey.unbootstrap()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
chocolatey.unbootstrap()
|
||||
|
||||
|
||||
def test_bootstrap(chocolatey, clean):
|
||||
|
|
|
@ -28,8 +28,10 @@ def clean(chocolatey_mod):
|
|||
except CommandExecutionError:
|
||||
chocolatey_version = None
|
||||
assert chocolatey_version is None
|
||||
yield
|
||||
chocolatey_mod.unbootstrap()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
chocolatey_mod.unbootstrap()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
@ -40,8 +42,10 @@ def installed(chocolatey_mod):
|
|||
except CommandExecutionError:
|
||||
chocolatey_version = None
|
||||
assert chocolatey_version is not None
|
||||
yield
|
||||
chocolatey_mod.unbootstrap()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
chocolatey_mod.unbootstrap()
|
||||
|
||||
|
||||
def test_bootstrapped(chocolatey, chocolatey_mod, clean):
|
||||
|
|
Loading…
Add table
Reference in a new issue