classification
Title: TextTestRunner doesn't honour "buffer" argument
Type: behavior Stage:
Components: Tests Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: José Luis Segura Lucas
Priority: normal Keywords:

Created on 2019-04-17 14:24 by José Luis Segura Lucas, last changed 2019-04-17 14:24 by José Luis Segura Lucas.

Messages (1)
msg340398 - (view) Author: José Luis Segura Lucas (José Luis Segura Lucas) Date: 2019-04-17 14:24
When using "buffer = True" in a TextTestRunner, the test result behaviour doesn't change at all.

This is because TextTestRunner.stream is initialised using a decorator (_WritelnDecorator). When "buffer" is passed, the TestResult base class will try to redirect the stdout and stderr to 2 different io.StringIO objects. As the TextTestRunner.stream is initialised before that "redirection", all the "self.stream.write" calls will end using the original stream (stderr by default), and resulting in not buffering at all.
History
Date User Action Args
2019-04-17 14:24:22José Luis Segura Lucascreate