From b83ec2621e2b64eaa1af9ebf9862ec2a3e0299a7 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:48:01 -0400 Subject: [PATCH 1/2] Fix Windows test hang by patching timed input --- src/tests/test_manager_list_entries.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/test_manager_list_entries.py b/src/tests/test_manager_list_entries.py index 6df3cb6..444d420 100644 --- a/src/tests/test_manager_list_entries.py +++ b/src/tests/test_manager_list_entries.py @@ -176,6 +176,8 @@ def _detail_common(monkeypatch, pm): monkeypatch.setattr( "password_manager.manager.confirm_action", lambda *a, **k: False ) + monkeypatch.setattr("password_manager.manager.timed_input", lambda *a, **k: "b") + monkeypatch.setattr("password_manager.manager.time.sleep", lambda *a, **k: None) monkeypatch.setattr(pm, "notify", lambda *a, **k: None) pm.password_generator = SimpleNamespace(generate_password=lambda l, i: "pw123") called = [] From e4093d733416ebd96f30c088ed32a2510a743c7e Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:56:48 -0400 Subject: [PATCH 2/2] Fix posix seed prompt test for Windows --- src/tests/test_seed_prompt.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/tests/test_seed_prompt.py b/src/tests/test_seed_prompt.py index 700c03f..3711cd4 100644 --- a/src/tests/test_seed_prompt.py +++ b/src/tests/test_seed_prompt.py @@ -6,9 +6,25 @@ def test_masked_input_posix_backspace(monkeypatch, capsys): seq = iter(["a", "b", "\x7f", "c", "\n"]) monkeypatch.setattr(seed_prompt.sys.stdin, "read", lambda n=1: next(seq)) monkeypatch.setattr(seed_prompt.sys.stdin, "fileno", lambda: 0) - monkeypatch.setattr(seed_prompt.termios, "tcgetattr", lambda fd: None) - monkeypatch.setattr(seed_prompt.termios, "tcsetattr", lambda fd, *_: None) - monkeypatch.setattr(seed_prompt.tty, "setraw", lambda fd: None) + + if seed_prompt.termios is None: + fake_termios = types.SimpleNamespace( + tcgetattr=lambda fd: None, + tcsetattr=lambda fd, *_: None, + TCSADRAIN=1, + ) + monkeypatch.setattr(seed_prompt, "termios", fake_termios) + else: + monkeypatch.setattr(seed_prompt.termios, "tcgetattr", lambda fd: None) + monkeypatch.setattr(seed_prompt.termios, "tcsetattr", lambda fd, *_: None) + + if seed_prompt.tty is None: + fake_tty = types.SimpleNamespace(setraw=lambda fd: None) + monkeypatch.setattr(seed_prompt, "tty", fake_tty) + else: + monkeypatch.setattr(seed_prompt.tty, "setraw", lambda fd: None) + + monkeypatch.setattr(seed_prompt.sys, "platform", "linux", raising=False) result = seed_prompt.masked_input("Enter: ") assert result == "ac"