New submission from Alexander Belchenko:
Why by default unittest.main (which uses unittest.TextTestRunner) prints
everything to stderr. What the reason behind this behavior?
It makes very inconvenient to run big test suite with less, i.e.
python test.py | less
or
python test.py > test.log
does not show me failed tests. They all go to stderr. Why?
Another thing: there is no easy way to override this. I have to subclass either
TestProgram or TextTestRunner and force sys.stdout rather than sys.stderr. E.g.
class TestProgram(unittest.TestProgram):
def runTests(self):
if self.testRunner is None:
self.testRunner = unittest.TextTestRunner(stream=sys.stdout,
verbosity=self.verbosity)
result = self.testRunner.run(self.test)
sys.exit(not result.wasSuccessful())
if __name__ == '__main__':
TestProgram()
Although it works for me I feel there is something wrong. Am I the only person
who needs test output on stdout?
----------
components: Library (Lib)
messages: 172375
nosy: bialix
priority: normal
severity: normal
status: open
title: there is no easy way to force unittest.main to use stdout rather than
stderr
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16164>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com