summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-02-07 16:10:59 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-02-07 16:10:59 +0000
commit466396592d7a5440379b0e606e7e8674c6d348fd (patch)
tree640119a5d8c2dc4438b29ba1044f30c25f7de3df /lldb/packages/Python/lldbsuite/test
parent871c30e540318b1ba2a6f9547df1937707755529 (diff)
downloadbcm5719-llvm-466396592d7a5440379b0e606e7e8674c6d348fd.tar.gz
bcm5719-llvm-466396592d7a5440379b0e606e7e8674c6d348fd.zip
[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. llvm-svn: 324488
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/decorators.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index 6ec74fb7069..4248c461c88 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -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"):
cat.extend(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):
'LLDB.h')
if os.path.exists(header):
return None
-
+
header = os.path.join(
os.environ["LLDB_SRC"],
"include",
OpenPOWER on IntegriCloud