Python unittest Notes

2016-11-13 Sun

Some notes about unittest, to aid my memory next time around.

Skipping unit tests

class SuperlativeTests(unittest.TestCase):

    @unittest.skip("As always, skip all failed tests")
    def test_success(self):
        self.fail("will never happen")

    @unittest.skipIf(datetime.datetime.today().weekday() != 6) # Friday?
    def test_weekendahoy(self):
        self.fail("rotten luck")

Details here.