[Lldb-commits] [lldb] r324488 - [test] Enable setting category for inline tests.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 7 08:10:59 PST 2018

Author: jdevlieghere
Date: Wed Feb  7 08:10:59 2018
New Revision: 324488

URL: http://llvm.org/viewvc/llvm-project?rev=324488&view=rev
[test] Enable setting category for inline tests.

Inlined tests have a test function that is actually an instance method,
which requires a slightly different approach when it comes to setting
the category attribute. The attribute must be set on the actual
function, rather than on a particular instance.


Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=324488&r1=324487&r2=324488&view=diff
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Wed Feb  7 08:10:59 2018
@@ -4,6 +4,7 @@ from __future__ import print_function
 # System modules
 from distutils.version import LooseVersion, StrictVersion
 from functools import wraps
+import inspect
 import os
 import platform
 import re
@@ -305,7 +306,11 @@ def add_test_categories(cat):
                 "@add_test_categories can only be used to decorate a test method")
         if hasattr(func, "categories"):
-        func.categories = cat
+        # For instance methods, the attribute must be set on the actual function.
+        if inspect.ismethod(func):
+            func.__func__.categories = cat
+        else:
+            func.categories = cat
         return func
     return impl
@@ -518,7 +523,7 @@ def skipIfNoSBHeaders(func):
             if os.path.exists(header):
                 return None
         header = os.path.join(

More information about the lldb-commits mailing list