Unit Test not running

后端 未结 1 1691
难免孤独
难免孤独 2020-12-08 18:34

I\'m getting stuck with some unittests.

Here\'s the simplest example I could come up with:

#testito.py
import unittest

class Prueba(unittest.TestCas         


        
相关标签:
1条回答
  • 2020-12-08 18:58

    By default, only functions whose name that start with test are run:

    class Prueba(unittest.TestCase):
    
        def setUp(self):
            pass
        def testPrintsTrue(self):
            self.assertTrue(True)
    

    From the unittest basic example:

    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.

    0 讨论(0)
提交回复
热议问题