Example #1
0
def no_tee():
    out = StringIO()
    final_out = [""]
    try:
        yield out, final_out
    finally:
        out.close()
Example #2
0
def tee_output_python():
    """Duplicate sys.stdout and sys.stderr to new StringIO."""
    out = StringIO()
    final_out = []
    flush()
    orig_stdout, orig_stderr = sys.stdout, sys.stderr
    sys.stdout = TeeingStreamProxy(sys.stdout, out)
    sys.stderr = TeeingStreamProxy(sys.stderr, out)
    try:
        yield out, final_out
    finally:
        flush()
        sys.stdout, sys.stderr = orig_stdout, orig_stderr
Example #3
0
def tee_output_python():
    """Duplicate sys.stdout and sys.stderr to new StringIO."""
    buffer = StringIO()
    out = CapturedStdout(buffer)
    orig_stdout, orig_stderr = sys.stdout, sys.stderr
    flush()
    sys.stdout = TeeingStreamProxy(sys.stdout, buffer)
    sys.stderr = TeeingStreamProxy(sys.stderr, buffer)
    try:
        yield out
    finally:
        flush()
        out.finalize()
        sys.stdout, sys.stderr = orig_stdout, orig_stderr
Example #4
0
def no_tee():
    out = CapturedStdout(StringIO())
    try:
        yield out
    finally:
        out.finalize()