Python's internal stderr may differ from sys.stderr. When Python writes errors, it uses its internal stderr rather than the overwritten sys.stderr. This may not be the same file/handle Fix the test to explicitly write to the specified stderr.
Python's internal stderr may differ from sys.stderr. When Python writes errors, it uses its internal stderr rather than the overwritten sys.stderr. This may not be the same file/handle Fix the test to explicitly write to the specified stderr.