From 6e81684913ca331630f22b5a8e471fae9a44d2cd Mon Sep 17 00:00:00 2001 From: Ilias Tsitsimpis Date: Mon, 10 Feb 2014 16:14:26 +0200 Subject: [PATCH] burnin: Skip whole testsuite Add functionality to allow burnin to skip a testsuite after it has been started. --- snf-tools/synnefo_tools/burnin/common.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/snf-tools/synnefo_tools/burnin/common.py b/snf-tools/synnefo_tools/burnin/common.py index 1585601d1..90c9c9a2b 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): -- GitLab