﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23930	Add context managers for capturing output (testing utils)	Wojtek Ruszczewski	nobody	"I've recently written something like this (for #23929, where the output is generated by a signal handler):

{{{#!python
@contextmanager
def capture_stdout():
    """"""
    Captures the ``sys.stdout`` stream, making anything written to it
    available in the stream returned as the manager's context.

    For example:

        with capture_stdout() as out:
            # Print something.
        self.assertIn(""something"", out.getvalue())
    """"""
    old_stdout = sys.stdout
    sys.stdout = out = StringIO()
    try:
        yield out
    finally:
        sys.stdout = old_stdout
}}}

Would it be better to make it public, leave it buried for the test only or don't bother testing the output in such cases at all?"	New feature	closed	Testing framework	dev	Normal	fixed			Accepted	1	0	0	0	0	0
