[IPython-dev] How to print stderr in qtconsole?

Carlos Córdoba ccordoba12@gmail....
Wed Jun 19 19:58:57 CDT 2013


Hi Min,

Thanks a lot for the tip. I decided to patch unittest.main (through our 
sitecustomize) so that it has the same testRunner arg as the one you 
mentioned. It seems overkilling that the user needs to pass it directly 
just to run his tests.

Cheers,
Carlos

El 10/06/13 20:47, MinRK escribió:
> It's probably an issue of unittest hooking up to `sys.__stderr__` 
> instead of `sys.stderr`. We don't (and shouldn't) redirect the 
> lower-level private handle, but you can tell it to use `sys.stderr` 
> instead:
>
> import sys
> import unittest
>
> class tests(unittest.TestCase):
>   def test_raise(self):
>       print 1 / 0
> if __name__ == '__main__':
> unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stderr))
>
> which should display output just fine in the QtConsole.
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20130619/a7689777/attachment.html 


More information about the IPython-dev mailing list