A better unittest

Alex Martelli aleax at aleax.it
Wed Apr 16 12:55:33 EDT 2003


Thomas Heller wrote:
   ...
> Hm, the latest version of the patch which I posted typically prints this:
> 
> ======================================================================
> FAIL: test_failUnlessEqual (__main__.FailingTests)
> ----------------------------------------------------------------------
> TestFailed: 0 != 1
>   File "xunit.py", line 12, in test_failUnlessEqual
>     self.failUnlessEqual(self.a, self.b)
> 
> Is this poorly formatted? I won't argue about this.

It's sure WAY better than what it does out of the box!!!

> Anyway, this is IMO the information I want to have:
> filename, line number, source code line, and the actual#
> values which made the test fail.

Seconded.

> Concerning the 'more is better': If the test crashes (raises an
> unexpected exception), the full traceback is printed.
> If the test fails because a condition is not fulfilled, I'm *not*
> interested to see how unittest raises this error.

Absolutely!!!  I think unittest would be MUCH better with
your mods.


Alex





More information about the Python-list mailing list