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