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.
397 B
397 B