test: add shared input/password fixture

This commit is contained in:
2025-12-23 04:45:48 +01:00
parent 66594d9f59
commit 1c4a256641

16
tests/conftest.py Normal file
View File

@@ -0,0 +1,16 @@
from typing import Iterable, Callable
import pytest
@pytest.fixture
def user_input(monkeypatch) -> Callable[[Iterable[str], Iterable[str]], None]:
def _set(inputs: Iterable[str], passwords: Iterable[str]) -> None:
input_iter = iter(inputs)
password_iter = iter(passwords)
monkeypatch.setattr("builtins.input", lambda _prompt: next(input_iter))
monkeypatch.setattr("getpass.getpass",
lambda _prompt: next(password_iter))
return _set