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 python-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 | 9 |
10 import tests_annotations | 10 import tests_annotations |
11 | 11 |
12 | 12 |
13 class TestInfo(object): | 13 class TestInfo(object): |
14 """An object containing and representing a test function, plus metadata.""" | 14 """An object containing and representing a test function, plus metadata.""" |
15 | 15 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 test_infos: a list of TestInfos representing test functions/methods. | 63 test_infos: a list of TestInfos representing test functions/methods. |
64 """ | 64 """ |
65 self.all_tests = test_infos | 65 self.all_tests = test_infos |
66 | 66 |
67 def GetAvailableTests(self, annotations, exclude_annotations, name_filter): | 67 def GetAvailableTests(self, annotations, exclude_annotations, name_filter): |
68 """Get a collection of TestInfos which match the supplied criteria. | 68 """Get a collection of TestInfos which match the supplied criteria. |
69 | 69 |
70 Args: | 70 Args: |
71 annotations: List of annotations. Each test in the returned list is | 71 annotations: List of annotations. Each test in the returned list is |
72 annotated with atleast one of these annotations. | 72 annotated with atleast one of these annotations. |
73 exlcude_annotations: List of annotations. The tests in the returned | 73 exclude_annotations: List of annotations. The tests in the returned |
74 list are not annotated with any of these annotations. | 74 list are not annotated with any of these annotations. |
75 name_filter: name filter which tests must match, if any | 75 name_filter: name filter which tests must match, if any |
76 | 76 |
77 Returns: | 77 Returns: |
78 List of available tests. | 78 List of available tests. |
79 """ | 79 """ |
80 available_tests = self.all_tests | 80 available_tests = self.all_tests |
81 | 81 |
82 # Filter out tests which match neither the requested annotation, nor the | 82 # Filter out tests which match neither the requested annotation, nor the |
83 # requested name filter, if any. | 83 # requested name filter, if any. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 Foo.testBar and Bar.testFoo. 'foo' would not match either. | 135 Foo.testBar and Bar.testFoo. 'foo' would not match either. |
136 | 136 |
137 Args: | 137 Args: |
138 test_info: TestInfo object representing the test | 138 test_info: TestInfo object representing the test |
139 name_filter: substring to check for in the qualified name of the test | 139 name_filter: substring to check for in the qualified name of the test |
140 | 140 |
141 Returns: | 141 Returns: |
142 True if no name filter supplied or it matches; False otherwise. | 142 True if no name filter supplied or it matches; False otherwise. |
143 """ | 143 """ |
144 return not name_filter or name_filter in test_info.qualified_name | 144 return not name_filter or name_filter in test_info.qualified_name |
OLD | NEW |