unittest output in IPython

ipython, python-unittest

Solution

Calling TextTestRunner with the stream parameter will make it work in IPython. This is how I run the tests:

suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
unittest.TextTestRunner(verbosity=1,stream=sys.stderr).run(suite)

Problem

I have a script for testing a module using unittest. When I run the script using the python console I get the output: ``` test_equal (__main__.TestOutcome) ... ok test_win_amount (__main__.TestOutcome) ... ok ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK ``` But, on running the same script using IPython console, I don't get any output. I am using the following to run my script, ``` suite = unittest.TestLoader().loadTestsFromTestCase(TestOutcome) unittest.TextTestRunner(verbosity=2).run(suite) ``` Any ideas if this might be due to IPython settings?

Original source