nose-devs/nose — Issue #242: Assert introspection doesn't always produce results
Author: jpellerin
Created: 2011-12-14 16:05:03+00:00
State: open

On version 0.10.0 and latest SVN trunk using the "-d" command line to evaluate failed asserts
doesn't emit the assert introspection output unless you:

a) disable captured output via "-s", or
b) print something to stdout in your test

The attached file (test_assert.py) generates the following:

$ nosetests -d test_assert.py
F
===========================================================
===========
FAIL: test_assert.testFailedAssertIntrospection
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/nose-0.11.0.dev_r380-py2.5.egg/nose/case.py", line
202, in runTest
self.test(*self.arg)
File "/tmp/nosetest/test_assert.py", line 3, in testFailedAssertIntrospection
assert a == 2
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)

Note that the assertion evaluation wasn't displayed as expected:

AssertionError
1 = 1
>> assert 1 == 2

The attached patch to nose/plugins/capture.py (capture.py.patch) fixes the problem by returning
errors regardless of whether output was produced.

Google Code Info:
Issue #: 134
Author: ryderb...@gmail.com
Created On: 2007-11-18T10:51:59.000Z
Closed On: 2007-11-19T15:22:18.000Z