lundi 2 novembre 2015

Add some text to assertion message in all tests [duplicate]

This question already has an answer here:

I want add some text for all failed tests (Without updating all text message).

import unittest
class TestCase(unittest.TestCase):
    def test1(self):
        self.assertTrue(False, "FAIL!")

    def test2(self):
        self.assertLessEqual(10, 2, "FAIL!")

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

Now I see result: AssertionError: FAIL!

My goal is to see: AssertionError: FAIL! + Some my debug information

Aucun commentaire:

Enregistrer un commentaire