Unittest tests order

后端 未结 19 1268
刺人心
刺人心 2020-12-01 03:17

How do I be sure of the unittest methods order? Is the alphabetical or numeric prefixes the proper way?

class TestFoo(TestCase):
    def test_1(self):
               


        
19条回答
  •  伪装坚强ぢ
    2020-12-01 04:05

    See the example of WidgetTestCase on http://docs.python.org/library/unittest.html#organizing-test-code , it says that

    Class instances will now each run one of the test_*() methods, with self.widget created and destroyed separately for each instance.

    So it might be of no use to specify the order of test cases, if you do not access global variables.

提交回复
热议问题