bobber6467 / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

Define __unittest in scope of nose's assertion helpers to hide noisy stack frames #459

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by grinche...@gmail.com on 18 Oct 2011 at 8:22