lib: reset settings when error is raised in patch

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-08-23 21:21:28 +02:00
parent b9294fd9ad
commit a099b21671
1 changed files with 4 additions and 2 deletions

View File

@ -152,8 +152,10 @@ class ConfigLoader:
"""Context manager for unittests to patch a value"""
original_value = self.y(path)
self.y_set(path, value)
yield
self.y_set(path, original_value)
try:
yield
finally:
self.y_set(path, original_value)
@property
def raw(self) -> dict: