summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Douard <david.douard@logilab.fr>2009-10-08 12:40:11 +0200
committerDavid Douard <david.douard@logilab.fr>2009-10-08 12:40:11 +0200
commit1c227f7ccb0075d9748f320ebc200ec160858ad6 (patch)
treed6a3807291a4be4ab9bd053d03aa6197d88d101f
parenta1833732361ed38666b2fcaad4893ab5f6b78ec6 (diff)
downloadlogilab-common-1c227f7ccb0075d9748f320ebc200ec160858ad6.tar.gz
Make it possible to tag test classes
If a tags is set on both a class and a method of this class, this latter take precedence in tag definition
-rw-r--r--testlib.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/testlib.py b/testlib.py
index f19d6d1..1a6b2dc 100644
--- a/testlib.py
+++ b/testlib.py
@@ -466,8 +466,13 @@ class SkipAwareTextTestRunner(unittest.TextTestRunner):
if self.options is not None:
tags_pattern = getattr(self.options, 'tags_pattern', None)
if tags_pattern is not None:
- tags = getattr(test, 'tags', Tags())
- return tags.match(tags_pattern)
+ tags = getattr(test, 'tags', None)
+ if tags is not None:
+ return tags.match(tags_pattern)
+ if isinstance(test, types.MethodType):
+ tags = getattr(test.im_class, 'tags', Tags())
+ return tags.match(tags_pattern)
+ return False
return True # no pattern
def _makeResult(self):