I'm trying to follow this post's recommendation to looping through nosetests but it does not work.
Here is sample code (I need a class implementation):
class NoseTesting(unittest.TestCase):
def _prepare_incredients(arg):
"""This is private method"""
logger.info("The args are == {0}".format(arg))
def test_make_icecream(self,):
logger.info("Test case starting")
for arg in ['sugar','cone']:
yield (self._prepare_incredients,arg)
If you actually read the documentation linked from the previous question:
As in the example, test generators must yield tuples, the first element of which must be a callable and the remaining elements the arguments to be passed to the callable.
Instead, you are calling the method within your "test generator" and yielding the result ( None
, in this case). Switch the relevant line to:
yield (self._prepare_incredients, arg)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.