Pytest: Mocking STDIN



examples/pytest/stdin/app.py

def ask_one():
    name = input("Please enter your name: ")
    print(f"Your name is {name}")

def ask_two():
    width = float(input("Please enter width: "))
    length = float(input("Please enter length: "))
    result = width * length
    print(f"{width}*{length} is {result}")


examples/pytest/stdin/use_app.py

import app

app.ask_one()
#app.ask_two()