How to capture stdout/stderr output — pytest documentation