diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | testlib.py | 10 |
2 files changed, 12 insertions, 0 deletions
@@ -4,6 +4,8 @@ ChangeLog for logilab.common -- * shellutils: restore py 2.5 compat by removing usage of class decorator * pytest: drop broken --coverage option + * testlib: support for skipping whole test class and conditional skip, don't + run setUp for skipped tests * configuration: load options in config file order (#185648) 2014-03-07 -- 0.62.0 @@ -579,6 +579,16 @@ class TestCase(unittest.TestCase): # if result.cvg: # result.cvg.start() testMethod = self._get_test_method() + if (getattr(self.__class__, "__unittest_skip__", False) or + getattr(testMethod, "__unittest_skip__", False)): + # If the class or method was skipped. + try: + skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') + or getattr(testMethod, '__unittest_skip_why__', '')) + self._addSkip(result, skip_why) + finally: + result.stopTest(self) + return if runcondition and not runcondition(testMethod): return # test is skipped result.startTest(self) |