In the middle of the desert you can say anything you want

12 Oct 2021

Day 1015

unittest skip test based on condition

From unittest documentation 1

class MyTestCase(unittest.TestCase):

    @unittest.skipIf(mylib.__version__ < (1, 3), "not supported in this library version")
    def test_format(self):
        # Tests that work for only a certain version of the library.

  1. unittest — Unit testing framework — Python 3.10.0 documentation ↩︎

Nel mezzo del deserto posso dire tutto quello che voglio.