[issue10786] unittest.TextTextRunner does not respect redirected stderr
Sylvain Corlay added the comment: Hello, It would be great if this modification was also done for Python 2.7. A reason is that IPython redirects stderr. When running unit tests in the IPython console without specifying the stream argument, the errors are printed in the shell. See http://python.6.x6.nabble.com/How-to-print-stderr-in-qtconsole-td5021001.html -- nosy: +sylvain.corlay versions: +Python 2.7 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Michael Foord mich...@voidspace.org.uk added the comment: Thanks Terry. Done. Doc changes committed revision 87679. -- keywords: -patch nosy: -MarkRoddy, terry.reedy resolution: - accepted stage: needs patch - committed/rejected status: open - closed type: feature request - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Terry J. Reedy tjre...@udel.edu added the comment: Since the current behavior matches the current doc, class unittest.TextTestRunner(stream=sys.stderr, descriptions=True, verbosity=1, runnerclass=None, warnings=None) A basic test runner implementation which prints results on standard error. ... this is a feature change request, not a bug report. Hence, the change should not be backported, lest it surprise someone. One could even question whether the change should be introduced now, but is does seem rather minor. That aside, the doc needs to be changed and a version-changed note added. Something like class unittest.TextTestRunner(stream=None, descriptions=True, verbosity=1, runnerclass=None, warnings=None) A basic test runner implementation. If *stream* is the default None, results go to standard error. ... Version changed 3.2: default stream determined when class is instantiated rather than when imported. -- nosy: +terry.reedy type: behavior - feature request versions: -Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Changes by Mark Roddy markro...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file20193/py27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Changes by Mark Roddy markro...@gmail.com: Added file: http://bugs.python.org/file20194/py32.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Mark Roddy markro...@gmail.com added the comment: All patches change the default value of stream to None in the constructor, and set it to the current to sys.stderr if the argument is None. Unit tests included to check this behavior. Also, the patch against Python 3.1 adds the Test_TextTestRunner test case to the list of tests to be run. Apparently this test case was not being run. -- nosy: +MarkRoddy Added file: http://bugs.python.org/file20195/py31.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Michael Foord mich...@voidspace.org.uk added the comment: Committed to py3k in revision 87582. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Changes by R. David Murray rdmur...@bitdance.com: -- keywords: +easy nosy: +michael.foord versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Michael Foord mich...@voidspace.org.uk added the comment: TextTestRunner is initialised with a stream to output messages on that defaults to sys.stderr. The correct way to redirect messages is to construct it with a different stream. If you want a redirectable stream then construct the runner with a stream that delegates operations to a 'backend stream' but allows you to redirect it. Fixing TextTestRunner to dynamically lookup up sys.stderr would not be compatible with systems that redirect sys.stderr but *don't* expect this to prevent test run information from being output. I suggest closing as wontfix. -- assignee: - michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
Michael Foord mich...@voidspace.org.uk added the comment: Actually I can't see a good reason why not to just lookup the *current* sys.stderr at instantiation time instead of binding at import time as is the current behaviour. Patch with tests will make it more likely that this change goes in sooner rather than later. -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10786] unittest.TextTextRunner does not respect redirected stderr
New submission from cooyeah cooy...@gmail.com: The constructor of TextTestRunner class looks like: def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1) Since the default parameter is evaluated only once, if sys.stderr is redirected later, the test would still use the old stderr when it was first initialized. -- components: Tests messages: 124764 nosy: cooyeah priority: normal severity: normal status: open title: unittest.TextTextRunner does not respect redirected stderr type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com