Message172375
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? |
|
Date |
User |
Action |
Args |
2012-10-08 11:58:20 | bialix | set | recipients:
+ bialix |
2012-10-08 11:58:20 | bialix | set | messageid: <1349697500.62.0.333745951917.issue16164@psf.upfronthosting.co.za> |
2012-10-08 11:58:20 | bialix | link | issue16164 messages |
2012-10-08 11:58:19 | bialix | create | |
|