<rdar://problem/13289828>
authorEnrico Granata <egranata@apple.com>
Wed, 27 Feb 2013 02:37:12 +0000 (02:37 +0000)
committerEnrico Granata <egranata@apple.com>
Wed, 27 Feb 2013 02:37:12 +0000 (02:37 +0000)
Categories were conceptually meant to be placeable on test methods as well as test classes and test directories
However, that was broken. This checkin fixes that.
The incantation required to put categories on individual test case methods is not exactly elegant, unfortunately:

def test_case(self):
    """Test me."""
    self.do_it()

def _test_case_get_categories(self):
    return ["demo"]

test_case.getCategories = _test_case_get_categories
del _test_case_get_categories

llvm-svn: 176158

lldb/test/dotest.py

index 4e1ce6d..6b7a75b 100755 (executable)
@@ -1392,7 +1392,14 @@ for ia in range(len(archs) if iterArchs else 1):
                     return str(test)
 
             def getCategoriesForTest(self,test):
-                if hasattr(test,"getCategories"):
+                if hasattr(test,"_testMethodName"):
+                    test_method = getattr(test,"_testMethodName")
+                    test_method = getattr(test,test_method)
+                else:
+                    test_method = None
+                if test_method != None and hasattr(test_method,"getCategories"):
+                    test_categories = test_method.getCategories(test)
+                elif hasattr(test,"getCategories"):
                     test_categories = test.getCategories()
                 elif inspect.ismethod(test) and test.__self__ != None and hasattr(test.__self__,"getCategories"):
                     test_categories = test.__self__.getCategories()