Unittest tests order

后端 未结 19 1260
刺人心
刺人心 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:03

    Contrary to what was said here: - tests have to run in isolation (order must not matters for that) AND - ordering them is important because they describe what the system do and how the developper implements it.

    IOW, each test brings you informations of the system and the developper logic.

    So if these informations are not ordered that can make your code difficult to understand.

提交回复
热议问题