How to mock stdin when using fileinput module?
How to mock stdin when using fileinput module? Question: I have a program that uses the Python fileinput module, and I am trying to write unittests for the main() function. They work find when using an actual file, but raise OSError: reading from stdin while output is captured when I try to pass data via …