[IPython-dev] How to print stderr in qtconsole?
Carlos Córdoba
ccordoba12 at gmail.com
Wed Jun 19 20:58:57 EDT 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130619/a7689777/attachment.html>
More information about the IPython-dev
mailing list