summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--testlib.py10
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0560fef..5406478 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/testlib.py b/testlib.py
index 817149c..683c7ac 100644
--- a/testlib.py
+++ b/testlib.py
@@ -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)