How to temporary hide stdout or stderr while running a unittest in Python
<p>I have a faulty third party python module that is outputing to stdout or stderr while it is imported and this is breaking the output of my unittests.</p>

<p>How can I temporary redirect the <code>stdout</code> in order to hide its output.</p>

<p>Limit to Python 2.5 syntax :)</p>

<p><strong>Update</strong>, I forgot to mention that <code>sys.stdout</code> and <code>sys.__stderr__</code> methods do not work in this case. As far as I know this faulty module is using native code.</p>
