diff --git a/snf-tools/synnefo_tools/burnin/common.py b/snf-tools/synnefo_tools/burnin/common.py index 1585601d1650683cb1eb57139632c9593b231eb7..90c9c9a2bcdb2be67c853c627412e4e2a65a4da3 100644 --- a/snf-tools/synnefo_tools/burnin/common.py +++ b/snf-tools/synnefo_tools/burnin/common.py @@ -105,6 +105,20 @@ class BurninTestResult(unittest.TestResult): super(BurninTestResult, self).addFailure(test, err) self._test_failed(test, err) + # pylint: disable=fixme + def addSkip(self, test, reason): # noqa + """Called when the test case test is skipped + + If reason starts with "__SkipClass__: " then + we should stop the execution of all the TestSuite. + + TODO: There should be a better way to do this + + """ + super(BurninTestResult, self).addSkip(test, reason) + if reason.startswith("__SkipClass__: "): + self.stop() + # -------------------------------------------------------------------- # Helper Classes @@ -347,6 +361,12 @@ class BurninTests(unittest.TestCase): self.info("Test skipped: %s" % msg) self.skipTest(msg) + def _skip_suite_if(self, condition, msg): + """Skip the whole testsuite""" + if condition: + self.info("TestSuite skipped: %s" % msg) + self.skipTest("__SkipClass__: %s" % msg) + # ---------------------------------- # Flavors def _get_list_of_flavors(self, detail=False):