In my case there was significant setup to do before I knew whether or not this test should be skipped, in which case you can call unittest.TestCase.skipTest, which just raises a unittest.SkipTest exception that is handled by the test runner. It looks like this:
In [40]: runner = unittest.TextTestRunner() In [41]: class testing(unittest.TestCase): def testblah(self): pass def setUp(self): self.skipTest('asdfasdf') def runTest(self): pass ....: In [42]: thistestclass=testing() In [43]: runner.run(thistestclass) s ---------------------------------------------------------------------- Ran 1 test in 0.000s OK (skipped=1) Out[43]:
No comments:
Post a Comment