While running a particular unittest
with pytest
, it occasionally fails with this error (mentioned in the title) and from the stack trace it happens on the line
choice = input().lower()
when the control reaches this statement, the entire function is:
def prompt_to_activate(bear, printer):
PROMPT_TO_ACTIVATE_STR = ('program has found {} to be useful '
'based of dependencies discovered from your '
'project files. \n Would you like to activate '
'it? (y/n)')
printer.print(PROMPT_TO_ACTIVATE_STR)
choice = input().lower()
if choice.startswith('y'):
return True
elif choice.startswith('n'):
return False
else:
return prompt_to_activate(bear, printer)
for i in range(0, 3):
a = i
print(a)
I tried adding some time.sleep(x)
before that statement but that wouldn't fix it. Can somebody tell me the exact reason why this is happening and how to fix it?
click.confirm()
– Footpath