Skip to content

Commit

Permalink
Update src/pytest_plone/fixtures/env.py
Browse files Browse the repository at this point in the history
Co-authored-by: David Glick <david@glicksoftware.com>
  • Loading branch information
ericof and davisagli authored Dec 5, 2023
1 parent f7007e3 commit d6de0ce
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/pytest_plone/fixtures/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def generate_mo():
key = "zope_i18n_compile_mo_files"
current_value = os.getenv(key, None)
os.environ[key] = "1"
yield
# Revert to previous state
if current_value is None:
os.environ.pop(key)
else:
os.environ[key] = current_value
try:
yield
finally:
# Revert to previous state
if current_value is None:
os.environ.pop(key)
else:
os.environ[key] = current_value

0 comments on commit d6de0ce

Please sign in to comment.