O'Reilly logo
  • Chris Kang thinks this is interesting:

capsys.readouterr()

From

Cover of Python Testing with pytest

Note

Retrieves what is cached in stdout and stderr from beginning of the function.