summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/test_result.py35
1 files changed, 14 insertions, 21 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/test_result.py b/lldb/packages/Python/lldbsuite/test/test_result.py
index efa44b0e48d..13500856e42 100644
--- a/lldb/packages/Python/lldbsuite/test/test_result.py
+++ b/lldb/packages/Python/lldbsuite/test/test_result.py
@@ -7,10 +7,7 @@ Provides the LLDBTestResult class, which holds information about progress
and results of a single test run.
"""
-from __future__ import absolute_import
-
# System modules
-import inspect
import os
# Third-party modules
@@ -102,22 +99,26 @@ class LLDBTestResult(unittest2.TextTestResult):
else:
return str(test)
- @staticmethod
- def _getFileBasedCategories(test):
+ def _getTestPath(self, test):
+ # Use test.test_filename if the test was created with
+ # lldbinline.MakeInlineTest().
+ if test is None:
+ return ""
+ elif hasattr(test, "test_filename"):
+ return test.test_filename
+ else:
+ import inspect
+ return inspect.getsourcefile(test.__class__)
+
+ def _getFileBasedCategories(self, test):
"""
Returns the list of categories to which this test case belongs by
collecting values of ".categories" files. We start at the folder the test is in
and traverse the hierarchy upwards until the test-suite root directory.
"""
- import inspect
- import os.path
- # Use test.test_filename if the test was created with
- # lldbinline.MakeInlineTest().
- if hasattr(test, 'test_filename'):
- start_path = test.test_filename
- else:
- start_path = inspect.getfile(test.__class__)
+ start_path = self._getTestPath(test)
+ import os.path
folder = os.path.dirname(start_path)
from lldbsuite import lldb_test_root as test_root
@@ -198,14 +199,6 @@ class LLDBTestResult(unittest2.TextTestResult):
exception = err_tuple[1]
return isinstance(exception, build_exception.BuildError)
- def _getTestPath(self, test):
- if test is None:
- return ""
- elif hasattr(test, "test_filename"):
- return test.test_filename
- else:
- return inspect.getsourcefile(test.__class__)
-
def _saveBuildErrorTuple(self, test, err):
# Adjust the error description so it prints the build command and build error
# rather than an uninformative Python backtrace.
OpenPOWER on IntegriCloud