lundi 1 juin 2015

Does setUp method from unittest.TestCase knows the next test case?

Does the setUp method from the unittest.TestCase knows what is the next test case that will be executed? For example:

import unittest

class Tests(unittest.TestCase):
    def setUp(self):
        print "The next test will be: " + self.next_test_name()

    def test_01(self):
        pass

    def test_02(self):
        pass

if __name__ == '__main__':
    unittest.main()

Such code should produce upon execution:

The next test will be: test_01
The next test will be: test_02

Aucun commentaire:

Enregistrer un commentaire