How to see intermediate fail results from unittest as tests are running?

Margie Roginski margieroginski at gmail.com
Thu Aug 19 03:20:12 CEST 2010


Hi,

I am using unittest in a fairly basic way, where I have a single file
that simply defines a class that inherits from unittest.TestCase and
then within that class I have a bunch of methods that start with
"test".  Within that file, at the bottom I have:

if __name__ == "__main__":
    unittest.main()

This works fine and it runs all of the testxx() methods in my file.
As it runs it prints if the tests passed or failed, but if they fail,
it does not print the details of the assert that made them fail.  It
collects this info up and prints it all at the end.

Ok - my question: Is there any way to get unittest to print the
details of the assert that made a test fail, as the tests are
running?  IE, after a test fails, I would like to see why, rather than
waiting until all the tests are done.

I've searched the doc and even looked at the code, and it seems the
answer is no, but I'm just wondering if I'm missing something.

Thanks!

Margie



More information about the Python-list mailing list