fix another test that uses stdin

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2021-11-27 15:34:29 -08:00
parent 733aad07b9
commit 81bdf27d67
2 changed files with 8 additions and 4 deletions

View file

@ -224,11 +224,12 @@ def should_not():
def mock_user_input(request, is_tty):
def _generator(target):
def _mock_user_input():
user_input = get_fixture(request, "user_input", "")
user_input = user_input.splitlines() if is_tty else [user_input]
user_input = get_fixture(request, "user_input", None)
if not user_input:
if user_input is None:
user_input = Exception("Unexpected call for user input")
else:
user_input = user_input.splitlines() if is_tty else [user_input]
return patch(target, side_effect=user_input)