Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1534)

Unified Diff: build/android/pylib/host_driven/test_info_collection.py

Issue 144183004: Convert to gtest-style filtering in instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/test_jar.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b0b76a9819881bca3fbe2e209372fd393ed2a747..150c4aef443bd95f4471020a40ec69e5eb152a89 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
from pylib.host_driven 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."""
@@ -98,9 +106,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
@staticmethod
@@ -130,18 +142,3 @@ class TestInfoCollection(object):
return True
return False
- @staticmethod
- def _NameFilterIncludesTest(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
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/test_jar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698