From ffe80e5b4daa29d7a33508c0e9096b3fbd7dc02a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 03:30:39 +0000 Subject: [PATCH] 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 <53631862+PR0M3TH3AN@users.noreply.github.com> --- src/tests/test_profile_management.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/tests/test_profile_management.py b/src/tests/test_profile_management.py index e5169a4a..41f23ae8 100644 --- a/src/tests/test_profile_management.py +++ b/src/tests/test_profile_management.py @@ -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