I'm using nose and I'm having troubles when using assert_in
with yield
.
Here's the code that causes the problem:
for row in rows:
yield assert_in, existing_name, row[self.search_field]
The error:
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
----------------------------------------------------------------------
I have a workaround, simply define my own assert_in
:
def assert_in(a,b):
if not a in b:
raise AssertionError("%r not in %r" % (a, b))
For some reason, this works. What causes the problem? I have a feeling that it's a nose bug, can anyone confirm?