我使用nose和我使用assert_in
與yield
時遇到麻煩。使用yield'與assert_in鼻子時出錯
下面是導致該問題的代碼:
for row in rows:
yield assert_in, existing_name, row[self.search_field]
錯誤:
Failure: ValueError (no such test method in <class 'nose.tools.trivial.Dummy'>: runTest) ... ERROR
======================================================================
ERROR: Failure: ValueError (no such test method in <class 'nose.tools.trivial.Dummy'>: runTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/maroun/.virtualenvs/ads_management/local/lib/python2.7/site-packages/nose/loader.py", line 289, in generate
yield MethodTestCase(test_func, arg=arg, descriptor=g)
File "/home/maroun/.virtualenvs/ads_management/local/lib/python2.7/site-packages/nose/case.py", line 345, in __init__
self.inst = self.cls()
File "/usr/lib/python2.7/unittest/case.py", line 191, in __init__
(self.__class__, methodName))
ValueError: no such test method in <class 'nose.tools.trivial.Dummy'>: runTest
----------------------------------------------------------------------
我有一種變通方法,簡單地定義自己的assert_in
:
def assert_in(a,b):
if not a in b:
raise AssertionError("%r not in %r" % (a, b))
出於某種原因,這作品。是什麼導致了問題?我有一種感覺,這是一個鼻子的bug,任何人都可以證實?