Python unittest and test discovery

前端 未结 4 1758
一生所求
一生所求 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:20

    You need to rename the methods to begin with the word "test".

    As seen on http://docs.python.org/library/unittest.html :

    A testcase is created by subclassing unittest.TestCase. The three individual tests are defined with methods whose names start with the letters test. This naming convention informs the test runner about which methods represent tests.

提交回复
热议问题