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

Unified Diff: build/buildpylib/common/unittest_util.py

Issue 14882007: Android: support glob-style gtest filters with content browser tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename to build/buildpylib. Created 7 years, 7 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
Index: build/buildpylib/common/unittest_util.py
diff --git a/chrome/test/pylib/common/unittest_util.py b/build/buildpylib/common/unittest_util.py
similarity index 93%
rename from chrome/test/pylib/common/unittest_util.py
rename to build/buildpylib/common/unittest_util.py
index 9de980515bc599c52689b6c880747437d15e5b7f..bf4041dae988a816e589d7e4646840a8b2e8e759 100644
--- a/chrome/test/pylib/common/unittest_util.py
+++ b/build/buildpylib/common/unittest_util.py
@@ -101,10 +101,17 @@ def FilterTestSuite(suite, gtest_filter):
def FilterTests(all_tests, gtest_filter):
- """Returns a filtered list of tests based on the given gtest filter.
+ """Filter a list of tests based on the given gtest filter.
See http://code.google.com/p/googletest/wiki/AdvancedGuide
for gtest_filter specification.
+
+ Args:
+ all_tests: List of tests (unittest.TestSuite) or test names.
+ gtest_filter: Filter to apply.
+
+ Returns:
+ Filtered subset of the given list of tests.
"""
pattern_groups = gtest_filter.split('-')
positive_patterns = pattern_groups[0].split(':')
@@ -114,7 +121,7 @@ def FilterTests(all_tests, gtest_filter):
tests = []
for test in all_tests:
- test_name = GetTestName(test)
+ test_name = test if isinstance(test, str) else GetTestName(test)
Paweł Hajdan Jr. 2013/05/28 17:00:06 Is this autodetection really needed and useful? I'
Sami 2013/05/28 17:17:06 Agreed, this is a little too magical. I've split t
# Test name must by matched by one positive pattern.
for pattern in positive_patterns:
if fnmatch.fnmatch(test_name, pattern):

Powered by Google App Engine
This is Rietveld 408576698