[Lldb-commits] [lldb] r176158 - <rdar://problem/13289828>

Enrico Granata egranata at apple.com
Tue Feb 26 18:37:12 PST 2013


Author: enrico
Date: Tue Feb 26 20:37:12 2013
New Revision: 176158

URL: http://llvm.org/viewvc/llvm-project?rev=176158&view=rev
Log:
<rdar://problem/13289828>

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


Modified:
    lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=176158&r1=176157&r2=176158&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Tue Feb 26 20:37:12 2013
@@ -1392,7 +1392,14 @@ for ia in range(len(archs) if iterArchs
                     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()





More information about the lldb-commits mailing list