Giving parameters into TestCase from Suite in python

后端 未结 5 864
滥情空心
滥情空心 2020-12-16 22:42

From python documentation(http://docs.python.org/library/unittest.html):

import unittest

class WidgetTestCase(unittest.TestCase):
    def setUp(self):
              


        
5条回答
  •  借酒劲吻你
    2020-12-16 23:12

    I don't believe so, the signature for setUp needs to be what unittest is expecting, afaik, setUp is automagically called within the testcase's run method as setUp()... you're not going to be able to pass it unless you override run to pass in the var you want. But I think what you want defeats the purpose of unit testing. Don't try to use a DRY philosophy with this, each unit you're testing should be a part of a class or even part of a function/method.

提交回复
热议问题