OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Module containing information about the host-driven tests.""" | 5 """Module containing information about the host-driven tests.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import sys | |
10 | 9 |
| 10 from pylib.constants import host_paths |
11 from pylib.host_driven import tests_annotations | 11 from pylib.host_driven import tests_annotations |
12 | 12 |
13 from pylib import constants | 13 with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
14 | 14 import unittest_util # pylint: disable=import-error |
15 sys.path.insert(0, | |
16 os.path.join(constants.DIR_SOURCE_ROOT, | |
17 'build', 'util', 'lib', 'common')) | |
18 | |
19 import unittest_util # pylint: disable=F0401 | |
20 | 15 |
21 class TestInfo(object): | 16 class TestInfo(object): |
22 """An object containing and representing a test function, plus metadata.""" | 17 """An object containing and representing a test function, plus metadata.""" |
23 | 18 |
24 def __init__(self, runnable, set_up=None, tear_down=None): | 19 def __init__(self, runnable, set_up=None, tear_down=None): |
25 # The actual test function/method. | 20 # The actual test function/method. |
26 self.runnable = runnable | 21 self.runnable = runnable |
27 # Qualified name of test function/method (e.g. FooModule.testBar). | 22 # Qualified name of test function/method (e.g. FooModule.testBar). |
28 self.qualified_name = self._GetQualifiedName(runnable) | 23 self.qualified_name = self._GetQualifiedName(runnable) |
29 # setUp and teardown functions, if any. | 24 # setUp and teardown functions, if any. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 value_list = filters[1].split(',') | 130 value_list = filters[1].split(',') |
136 for value in value_list: | 131 for value in value_list: |
137 if tests_annotations.AnnotatedFunctions.IsAnnotated( | 132 if tests_annotations.AnnotatedFunctions.IsAnnotated( |
138 key + ':' + value, test_info.qualified_name): | 133 key + ':' + value, test_info.qualified_name): |
139 return True | 134 return True |
140 elif tests_annotations.AnnotatedFunctions.IsAnnotated( | 135 elif tests_annotations.AnnotatedFunctions.IsAnnotated( |
141 annotation_filter, test_info.qualified_name): | 136 annotation_filter, test_info.qualified_name): |
142 return True | 137 return True |
143 return False | 138 return False |
144 | 139 |
OLD | NEW |