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

Unified Diff: Tools/Scripts/webkitpy/w3c/test_parser.py

Issue 15901008: Modify w3c import script to be able to run over a whole repo. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add more FIXME comments for error handling 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
« no previous file with comments | « Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/webkitpy/w3c/test_parser.py
diff --git a/Tools/Scripts/webkitpy/w3c/test_parser.py b/Tools/Scripts/webkitpy/w3c/test_parser.py
index 8f227ee7f717c7f7aa5d6c8bb673af3cc457720c..65e55f128cc5f14ba52ae066dbbdb9ce595f0cfb 100644
--- a/Tools/Scripts/webkitpy/w3c/test_parser.py
+++ b/Tools/Scripts/webkitpy/w3c/test_parser.py
@@ -46,9 +46,17 @@ class TestParser(object):
self.load_file(filename)
def load_file(self, filename):
- if self.filesystem.exists(filename):
- self.test_doc = Parser(self.filesystem.read_binary_file(filename))
+ if self.filesystem.isfile(filename):
+ try:
+ self.test_doc = Parser(self.filesystem.read_binary_file(filename))
+ except:
+ # FIXME: Figure out what to do if we can't parse the file.
+ print "Error: failed to parse %s" % filename
+ self.test_doc is None
else:
+ if self.filesystem.isdir(filename):
+ # FIXME: Figure out what is triggering this and what to do about it.
+ print "Error: trying to load %s, which is a directory" % filename
self.test_doc = None
self.ref_doc = None
@@ -73,7 +81,13 @@ class TestParser(object):
if len(matches) > 1:
print 'Warning: Webkit does not support multiple references. Importing the first ref defined in ' + self.filesystem.basename(self.filename)
- ref_file = self.filesystem.join(self.filesystem.dirname(self.filename), matches[0]['href'])
+ try:
+ ref_file = self.filesystem.join(self.filesystem.dirname(self.filename), matches[0]['href'])
+ except KeyError as e:
+ # FIXME: Figure out what to do w/ invalid test files.
+ print "Error: %s is has a reference link but is missing the 'href'" % (self.filesystem)
ojan 2013/05/28 23:45:54 s/is has/has/
+ return None
+
if self.ref_doc is None:
self.ref_doc = self.load_file(ref_file)
« no previous file with comments | « Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698