Re: [Python-Dev] [Python-3000-checkins] r61522 - python/branches/py3k/Lib/test/test_print.py

eric.smith wrote:
+@contextmanager +def stdout_redirected(new_stdout): + save_stdout = sys.stdout + sys.stdout = new_stdout + try: + yield None + finally: + sys.stdout = save_stdout
I think this test could easily be tweaked to use test.test_support.captured_stdout rather than reinventing the wheel :) (cc'ing python-dev for visibility since the sprints are generating a lot of python-checkins traffic) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org

Nick Coghlan wrote:
eric.smith wrote:
+@contextmanager +def stdout_redirected(new_stdout): + save_stdout = sys.stdout + sys.stdout = new_stdout + try: + yield None + finally: + sys.stdout = save_stdout
I think this test could easily be tweaked to use test.test_support.captured_stdout rather than reinventing the wheel :)
Who reinvented the wheel? I stole this code from the PEP! :) I'll modify it. Thanks for noticing. Eric.
participants (2)
-
Eric Smith
-
Nick Coghlan