| Index: build/android/pylib/host_driven/test_info_collection.py
|
| diff --git a/build/android/pylib/host_driven/test_info_collection.py b/build/android/pylib/host_driven/test_info_collection.py
|
| index a857d3c1cdf2e63b92c3f62cda2d860f85517732..8a6fbd36113eadcdf53ed4f71e46190e83bb037b 100644
|
| --- a/build/android/pylib/host_driven/test_info_collection.py
|
| +++ b/build/android/pylib/host_driven/test_info_collection.py
|
| @@ -6,9 +6,17 @@
|
|
|
| import logging
|
| import os
|
| +import sys
|
|
|
| import tests_annotations
|
|
|
| +from pylib import constants
|
| +
|
| +sys.path.insert(0,
|
| + os.path.join(constants.DIR_SOURCE_ROOT,
|
| + 'build', 'util', 'lib', 'common'))
|
| +
|
| +import unittest_util
|
|
|
| class TestInfo(object):
|
| """An object containing and representing a test function, plus metadata."""
|
| @@ -97,9 +105,13 @@ class TestInfoCollection(object):
|
| excluded_tests = [t for t in available_tests if
|
| self._AnnotationIncludesTest(t, exclude_annotations)]
|
| available_tests = list(set(available_tests) - set(excluded_tests))
|
| - available_tests = [t for t in available_tests if
|
| - self._NameFilterIncludesTest(t, name_filter)]
|
|
|
| + if name_filter:
|
| + available_test_names = unittest_util.FilterTestNames(
|
| + [t.qualified_name for t in available_tests], name_filter)
|
| + available_tests = [
|
| + t for t in available_tests if
|
| + t.qualified_name in available_test_names]
|
| return available_tests
|
|
|
| def _AnnotationIncludesTest(self, test_info, annotation_filter_list):
|
| @@ -128,17 +140,3 @@ class TestInfoCollection(object):
|
| return True
|
| return False
|
|
|
| - def _NameFilterIncludesTest(self, test_info, name_filter):
|
| - """Checks whether a name filter matches a given test_info's method name.
|
| -
|
| - This is a case-sensitive, substring comparison: 'Foo' will match methods
|
| - Foo.testBar and Bar.testFoo. 'foo' would not match either.
|
| -
|
| - Args:
|
| - test_info: TestInfo object representing the test
|
| - name_filter: substring to check for in the qualified name of the test
|
| -
|
| - Returns:
|
| - True if no name filter supplied or it matches; False otherwise.
|
| - """
|
| - return not name_filter or name_filter in test_info.qualified_name
|
|
|