mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 07:52:03 +00:00
Fix Windows CI failure in test_profile_management.py
Replace unsafe module reloading with explicit monkeypatching of constants. This prevents potential OSError: [Errno 22] Invalid argument on Windows during TemporaryDirectory cleanup or test execution when modules are reloaded in a way that affects global state or file handles. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
af32d2844c
commit
ffe80e5b4d
1 file changed
+10
-3
@@ -22,10 +22,17 @@ from seedpass.core.config_manager import ConfigManager
|
||||
def test_add_and_delete_entry(monkeypatch):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
tmp_path = Path(tmpdir)
|
||||
monkeypatch.setattr(Path, "home", lambda: tmp_path)
|
||||
app_dir = tmp_path / ".seedpass"
|
||||
parent_seed_file = app_dir / "parent_seed.enc"
|
||||
checksum_file = app_dir / "seedpass_script_checksum.txt"
|
||||
|
||||
importlib.reload(constants)
|
||||
importlib.reload(manager_module)
|
||||
monkeypatch.setattr(constants, "APP_DIR", app_dir)
|
||||
monkeypatch.setattr(constants, "PARENT_SEED_FILE", parent_seed_file)
|
||||
monkeypatch.setattr(constants, "SCRIPT_CHECKSUM_FILE", checksum_file)
|
||||
|
||||
monkeypatch.setattr(manager_module, "APP_DIR", app_dir)
|
||||
monkeypatch.setattr(manager_module, "PARENT_SEED_FILE", parent_seed_file)
|
||||
monkeypatch.setattr(manager_module, "SCRIPT_CHECKSUM_FILE", checksum_file)
|
||||
|
||||
pm = manager_module.PasswordManager.__new__(manager_module.PasswordManager)
|
||||
pm.encryption_mode = EncryptionMode.SEED_ONLY
|
||||
|
||||
Reference in new issue
Block a user