From 2f91fef6e9d9d28fbb34f5b57760610cf6ab33ab Mon Sep 17 00:00:00 2001 From: "Szu-Yu Chen [:aknow]" Date: Thu, 15 Aug 2013 08:25:56 -0400 Subject: [PATCH] Bug 905510 - Handle imported file not found. r=hsinyi --- .../tests/marionette/test_ril_code_quality.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dom/system/gonk/tests/marionette/test_ril_code_quality.py b/dom/system/gonk/tests/marionette/test_ril_code_quality.py index 242ac20128d..a64fb52aa39 100644 --- a/dom/system/gonk/tests/marionette/test_ril_code_quality.py +++ b/dom/system/gonk/tests/marionette/test_ril_code_quality.py @@ -140,7 +140,10 @@ class ResourceUriFileReader: @classmethod def get_uri(cls, filename): """Convert filename to URI in system.""" - return cls.URI_PREFIX + cls.URI_PATH[filename] + if filename.startswith(cls.URI_PREFIX): + return filename + else: + return cls.URI_PREFIX + cls.URI_PATH[filename] def __init__(self, marionette): self.runjs = lambda x: marionette.execute_script(x, new_sandbox=False) @@ -278,13 +281,15 @@ class Linter: # Maintain a mapping table. # New line number after merge => original file and line number. info.append((dst_line, filepath, 1)) - - code = self.code_reader.read_file(filepath) - lines = code.splitlines(True) # Keep '\n'. - src_results = StringUtility.auto_wrap_strict_mode( - StringUtility.auto_close(lines)) - dst_results.extend(src_results) - dst_line += len(src_results) + try: + code = self.code_reader.read_file(filepath) + lines = code.splitlines(True) # Keep '\n'. + src_results = StringUtility.auto_wrap_strict_mode( + StringUtility.auto_close(lines)) + dst_results.extend(src_results) + dst_line += len(src_results) + except: + info.pop() return dst_results, info def _convert_merged_result(self, error_lines, line_info):