Skip to content

'print' statement ignores 'sys.stdout' #39

Open
@alanjds

Description

@alanjds

google#290 opened by @alanjds on 22 Apr 2017

Replacing sys.stdout have no effect over print statement.

This test script outputs AssertionError: 0 chars printed, instead of 3, after printing 'foo' in the stdout.

import StringIO
import sys

sio = StringIO()
stdout = sys.stdout
sys.stdout = sio

print 'foo'

sys.stdout = stdout

chars = sio.tell()
assert chars == 3, '%s chars printed, instead of 3' % chars

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix availableA fix code is available. If is good to be merged is another storyimportedImported from google/grumpy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions