OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Helper class for instrumenation test jar.""" | 5 """Helper class for instrumenation test jar.""" |
6 | 6 |
7 import collections | 7 import collections |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import pickle | 10 import pickle |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 """ | 190 """ |
191 if annotation_filter_list: | 191 if annotation_filter_list: |
192 available_tests = self.GetAnnotatedTests(annotation_filter_list) | 192 available_tests = self.GetAnnotatedTests(annotation_filter_list) |
193 # Include un-annotated tests in SmallTest. | 193 # Include un-annotated tests in SmallTest. |
194 if annotation_filter_list.count(self._DEFAULT_ANNOTATION) > 0: | 194 if annotation_filter_list.count(self._DEFAULT_ANNOTATION) > 0: |
195 for test in self._GetTestsMissingAnnotation(): | 195 for test in self._GetTestsMissingAnnotation(): |
196 logging.warning( | 196 logging.warning( |
197 '%s has no annotations. Assuming "%s".', test, | 197 '%s has no annotations. Assuming "%s".', test, |
198 self._DEFAULT_ANNOTATION) | 198 self._DEFAULT_ANNOTATION) |
199 available_tests.append(test) | 199 available_tests.append(test) |
200 excluded_tests = self.GetAnnotatedTests(exclude_annotation_list) | 200 if exclude_annotation_list: |
201 available_tests = list(set(available_tests) - set(excluded_tests)) | 201 excluded_tests = self.GetAnnotatedTests(exclude_annotation_list) |
| 202 available_tests = list(set(available_tests) - set(excluded_tests)) |
202 else: | 203 else: |
203 available_tests = [m for m in self.GetTestMethods() | 204 available_tests = [m for m in self.GetTestMethods() |
204 if not self.IsPythonDrivenTest(m)] | 205 if not self.IsPythonDrivenTest(m)] |
205 | 206 |
206 tests = [] | 207 tests = [] |
207 if test_filter: | 208 if test_filter: |
208 # |available_tests| are in adb instrument format: package.path.class#test. | 209 # |available_tests| are in adb instrument format: package.path.class#test. |
209 filter_without_hash = test_filter.replace('#', '.') | 210 filter_without_hash = test_filter.replace('#', '.') |
210 tests = [t for t in available_tests | 211 tests = [t for t in available_tests |
211 if filter_without_hash in t.replace('#', '.')] | 212 if filter_without_hash in t.replace('#', '.')] |
212 else: | 213 else: |
213 tests = available_tests | 214 tests = available_tests |
214 | 215 |
215 return tests | 216 return tests |
216 | 217 |
217 @staticmethod | 218 @staticmethod |
218 def IsPythonDrivenTest(test): | 219 def IsPythonDrivenTest(test): |
219 return 'pythonDrivenTests' in test | 220 return 'pythonDrivenTests' in test |
OLD | NEW |