nose-devs/nose — Issue #453: Define __unittest in scope of nose's assertion helpers to hide noisy stack frames
Author: jpellerin
Created: 2011-12-14 16:11:52+00:00
State: open

On test failure or error, unittest uses some handy machinery for hiding the traceback frames that are internal to unittest (and thus very probably not broken). Specifically, it will hide any frames where a global __unittest symbol is in scope. What do you think of putting eq_(), assert_raises(), and similar functions someplace where a __unittest var is defined?

It would turn this...

======================================================================
FAIL: Video modal defaults for plcaeholder and text.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/erose/Checkouts/kitsune/apps/wiki/tests/test_parser.py", line 449, in test_video_modal
eq_(1, doc('video video').length)
File "/Users/erose/Checkouts/kitsune/vendor/packages/nose/nose/tools.py", line 31, in eq_
assert a == b, msg or "%r != %r" % (a, b)
AssertionError: 1 != 0
----------------------------------------------------------------------

...into this:

======================================================================
FAIL: Video modal defaults for plcaeholder and text.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/erose/Checkouts/kitsune/apps/wiki/tests/test_parser.py", line 449, in test_video_modal
eq_(1, doc('video video').length)
AssertionError: 1 != 0

----------------------------------------------------------------------

...saving lines and noise.

Google Code Info:
Issue #: 459
Author: grinche...@gmail.com
Created On: 2011-10-18T08:22:28.000Z
Closed On: