def test_something_that_involves_user_input(monkeypatch):
    monkeypatch.setitem(__builtins__, 'input', lambda x: 'Mark')
i = eval(input('What is your name?'))
assert i == 'Mark'
Pytest: How to test a function with input call?