Looks like pytest sets __stdout__ to TextIOBase.