【发布时间】:2012-07-10 16:12:18
【问题描述】:
我正在编写一个带鼻子的测试服,并希望失败的案例显示类似的输出
“失败: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
----------------------------------------------------------------------
鼻子有什么选择吗?
【问题讨论】:
标签: python testing nose nosetests