Python unittest and test discovery

前端 未结 4 1760
一生所求
一生所求 2020-12-18 20:47

What exactly I need to do to make python\'s unittest work? I checked the official documentation, SO questions and even tried using nose, b

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-18 21:18

    unittest.main() will run all the function that begin by "test". So you should rename your functions

    class EchoTest(unittest.TestCase):  
        def testfoo(self):
            self.assertTrue(1==1)
    
        def testbar(self):
            self.assertTrue(1==2)
    

提交回复
热议问题