[Patches] [ python-Patches-722638 ] Better output for unittest
SourceForge.net
noreply@sourceforge.net
Sat, 19 Apr 2003 19:57:34 -0700
Patches item #722638, was opened at 2003-04-16 10:49
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=722638&group_id=5470
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Nobody/Anonymous (nobody)
Summary: Better output for unittest
Initial Comment:
This patch enables more useful output for unittests: If
a test crashes (raises an unexpected exception), a full
traceback is printed.
If a test failes, the output is something like this:
========================================
FAIL: test_failUnlessEqual (__main__.FailingTests)
----------------------------------------------------------------------
TestFailed: 0 != 1
File "xunit.py", line 12, in test_failUnlessEqual
self.failUnlessEqual(self.a, self.b)
========================================
Before, this was printed:
========================================
FAIL: test_failIfEqual (__main__.FailingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "xunit.py", line 15, in test_failIfEqual
self.failIfEqual(self.a, self.a)
File "c:\python23\lib\unittest.py", line 300, in
failIfEqual
raise self.failureException, \
AssertionError: 0 == 0
========================================
If needed, I can upload the test script I use, together
with the results before and after the patch.
This has shortly been discussed on c.l.p, response was
mostly positive.
http://tinyurl.com/9obf
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2003-04-19 19:57
Message:
Logged In: YES
user_id=357491
I like the new output, personally. I am +1 on letting Thomas add the
changes.
Does this mean we no longer treat unittest as a separate project?
----------------------------------------------------------------------
Comment By: Thomas Heller (theller)
Date: 2003-04-17 08:31
Message:
Logged In: YES
user_id=11105
Attaching new version of the patch (unittest-2.diff). This
gives better output for failUnlessRaises, like this:
======================================================================
FAIL: test_failUnlessRaises (__main__.FailingTests)
----------------------------------------------------------------------
TestFailed: wrong exception, expected TypeError
got: 'ValueError: 10'
File "xunit.py", line 18, in test_failUnlessRaises
self.failUnlessRaises(TypeError, self._raise,
ValueError, 10)
======================================================================
FAIL: test_failUnlessRaises_2 (__main__.FailingTests)
----------------------------------------------------------------------
TestFailed: wrong exception, expected TypeError, IndexError,
or AttributeError
got: 'ValueError: 10'
File "xunit.py", line 21, in test_failUnlessRaises_2
self.failUnlessRaises((TypeError, IndexError,
AttributeError), self._raise, ValueError, 10)
----------------------------------------------------------------------
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=722638&group_id=5470