我正在用鼻子写一个测试服,并且希望失败的案例显示一个输出,比如
“失败:is_even(5):不偶数”
而不是默认输出:
======================================================================
FAIL: seed_db.test_generator(5,)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/apurcell/tests/prism/seed_db.py", line 59, in is_even
nose.tools.eq_(x % 2, 0, msg="Not even")
File "/usr/local/lib/python2.7/dist-packages/nose/tools.py", line 31, in eq_
assert a == b, msg or "%r != %r" % (a, b)
AssertionError: Not even
----------------------------------------------------------------------
鼻子有没有办法做到这一点?