Index: media/tools/layout_tests/layouttests.py |
diff --git a/media/tools/layout_tests/layouttests.py b/media/tools/layout_tests/layouttests.py |
index 0d9a9c6f70a7a17d9758b051af9d3f10ae4573e3..4d1a37df1f0e00cce2e5802f800b6b001d16aec1 100644 |
--- a/media/tools/layout_tests/layouttests.py |
+++ b/media/tools/layout_tests/layouttests.py |
@@ -11,11 +11,10 @@ layout test cases (including description). |
import copy |
import csv |
import locale |
-import pysvn |
import re |
import sys |
import urllib2 |
- |
+import pysvn |
dennis_jeffrey
2012/02/29 17:50:32
nit: add a blank line above this, to separate the
imasaki1
2012/03/02 19:12:07
Done.
|
# Webkit SVN root location. |
DEFAULT_LAYOUTTEST_LOCATION = ( |
@@ -69,7 +68,7 @@ class LayoutTests(object): |
self.name_map = copy.copy(name_map) |
if filter_names: |
# Filter names. |
- for lt_name in name_map.keys(): |
+ for lt_name in name_map.iterkeys(): |
match = False |
for filter_name in filter_names: |
if re.search(filter_name, lt_name): |
@@ -78,7 +77,7 @@ class LayoutTests(object): |
if not match: |
del self.name_map[lt_name] |
# We get description only for the filtered names. |
- for lt_name in self.name_map.keys(): |
+ for lt_name in self.name_map.iterkeys(): |
self.name_map[lt_name] = LayoutTests.GetTestDescriptionFromSVN(lt_name) |
@staticmethod |
@@ -110,7 +109,7 @@ class LayoutTests(object): |
pattern = r'<p>(.*' + keyword + '.*)</p>' |
matches = re.search(pattern, txt) |
if matches is not None: |
- return matches.group(1).strip() |
+ return matches.group(1).strip() |
# (2) Try to find it by using more generic keywords such as 'PASS' etc. |
for keyword in KEYWORD_FOR_TEST_DESCRIPTION_FAIL_SAFE: |
@@ -118,16 +117,16 @@ class LayoutTests(object): |
pattern = r'\n(.*' + keyword + '.*)\n' |
matches = re.search(pattern, txt) |
if matches is not None: |
- # Remove 'p' tag. |
- text = matches.group(1).strip() |
- return text.replace('<p>', '').replace('</p>', '') |
+ # Remove 'p' tag. |
+ text = matches.group(1).strip() |
+ return text.replace('<p>', '').replace('</p>', '') |
# (3) Try to find it by using HTML tag such as title. |
for tag in TAGS_FOR_TEST_DESCRIPTION: |
pattern = r'<' + tag + '>(.*)</' + tag + '>' |
matches = re.search(pattern, txt) |
if matches is not None: |
- return matches.group(1).strip() |
+ return matches.group(1).strip() |
# (4) Try to find it by using test description and remove 'p' tag. |
for keyword in KEYWORDS_FOR_TEST_DESCRIPTION: |
@@ -135,9 +134,9 @@ class LayoutTests(object): |
pattern = r'\n(.*' + keyword + '.*)\n' |
matches = re.search(pattern, txt) |
if matches is not None: |
- # Remove 'p' tag. |
- text = matches.group(1).strip() |
- return text.replace('<p>', '').replace('</p>', '') |
+ # Remove 'p' tag. |
+ text = matches.group(1).strip() |
+ return text.replace('<p>', '').replace('</p>', '') |
# (5) cannot find test description using existing rules. |
return 'UNKNOWN' |
@@ -184,6 +183,9 @@ class LayoutTests(object): |
csv_file_path: the path for the CSV file containing test names (including |
regular expression patterns). The CSV file content has one column and |
each row contains a test name. |
+ |
+ Returns: |
+ a list of test names in string. |
""" |
file_object = file(csv_file_path, 'r') |
reader = csv.reader(file_object) |
@@ -198,6 +200,9 @@ class LayoutTests(object): |
Args: |
names: a list of test names. The test names also have path information as |
well (e.g., media/video-zoom.html). |
+ |
+ Returns: |
+ a list of parent directory for given test names. |
dennis_jeffrey
2012/02/29 17:50:32
directory --> directories
dennis_jeffrey
2012/02/29 17:50:32
for given --> for the given
imasaki1
2012/03/02 19:12:07
Done.
imasaki1
2012/03/02 19:12:07
Done.
|
""" |
pd_map = {} |
for name in names: |