This was adapted from an example in the python docs and solves test failures seen on the CI. We need to write to the underlying buffer object of the stream, but in case sys.stdout was replaced with a file-like object without a buffer there's a fallback to direct writing.
This was adapted from an example in the python docs and solves test failures seen on the CI. We need to write to the underlying buffer object of the stream, but in case
sys.stdout
was replaced with a file-like object without a buffer there's a fallback to direct writing.