Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions tests/hermes_cli/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2296,10 +2296,9 @@ def hermes_home(self, tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_HOME", str(root))
# Make Path.home() point at tmp_path for anything that uses it
monkeypatch.setattr(Path, "home", lambda: tmp_path)
# Bust caches for hermes_cli.config + hermes_constants so they pick up HERMES_HOME
for mod in list(__import__("sys").modules.keys()):
if mod.startswith("hermes_cli.config") or mod == "hermes_constants":
del __import__("sys").modules[mod]
# Config reads resolve HERMES_HOME dynamically and their caches are
# keyed by config path. Do not remove shared modules from sys.modules:
# other test modules may retain imports from the existing module object.
return root

@staticmethod
Expand All @@ -2309,10 +2308,6 @@ def _set_mode(hermes_home, value):
"_config_version": 22,
"updates": {"pre_update_backup": value},
}))
import sys as _sys
for mod in list(_sys.modules.keys()):
if mod.startswith("hermes_cli.config"):
del _sys.modules[mod]

@staticmethod
def _zips(hermes_home):
Expand Down
Loading