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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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: Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py b/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py
index 5210596a454b59cd5d9f5af8e7905003c98f5a80..7348370110de2882a1613fb37f80413b2c31f669 100644
--- a/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py
+++ b/Tools/Scripts/webkitpy/layout_tests/generate_results_dashboard.py
@@ -59,9 +59,9 @@ class ProcessJsonData(object):
row = []
length = len(self._old_failing_results_list)
for index in range(0, length):
- result = self._recurse_json_object(self._old_failing_results_list[index]["tests"], key_list)
+ result = self._recurse_json_object(self._old_failing_results_list[index]['tests'], key_list)
if result == 'NOTFOUND':
- result = self._recurse_json_object(self._old_full_results_list[index]["tests"], key_list)
+ result = self._recurse_json_object(self._old_full_results_list[index]['tests'], key_list)
row.append(result)
return row
@@ -70,7 +70,7 @@ class ProcessJsonData(object):
def _process_json_object(self, json_object, keyList):
for key, subdict in json_object.iteritems():
- if type(subdict) == dict:
+ if isinstance(subdict, dict):
self._process_json_object(subdict, keyList + [key])
else:
row = [self._get_test_result(json_object)]
@@ -80,8 +80,8 @@ class ProcessJsonData(object):
return
def generate_archived_result(self):
- for key in self._current_result_json_dict["tests"]:
- self._process_json_object(self._current_result_json_dict["tests"][key], [key])
+ for key in self._current_result_json_dict['tests']:
+ self._process_json_object(self._current_result_json_dict['tests'][key], [key])
return self._current_result_json_dict
@@ -104,7 +104,9 @@ class GenerateDashBoard(object):
def _copy_dashboard_html(self):
dashboard_file = self._filesystem.join(self._results_directory, 'dashboard.html')
- dashboard_html_file_path = self._filesystem.join(self._port.layout_tests_dir(), 'fast/harness/archived-results-dashboard.html')
+ dashboard_html_file_path = self._filesystem.join(
+ self._port.layout_tests_dir(),
+ 'fast/harness/archived-results-dashboard.html')
if not self._filesystem.exists(dashboard_file):
if self._filesystem.exists(dashboard_html_file_path):
self._filesystem.copyfile(dashboard_html_file_path, dashboard_file)
@@ -116,7 +118,7 @@ class GenerateDashBoard(object):
if self._filesystem.isdir(self._filesystem.join(self._results_directory_path, dir)):
results_directories.append(self._filesystem.join(self._results_directory_path, dir))
results_directories.sort(reverse=True, key=lambda x: self._filesystem.mtime(x))
- with open(self._filesystem.join(results_directories[0], 'failing_results.json'), "r") as file:
+ with open(self._filesystem.join(results_directories[0], 'failing_results.json'), 'r') as file:
input_json_string = file.readline()
input_json_string = input_json_string[12:-2] # Remove preceeding string ADD_RESULTS( and ); at the end
self._current_result_json_dict['tests'] = json.loads(input_json_string)['tests']
@@ -127,21 +129,24 @@ class GenerateDashBoard(object):
# Load the remaining stale layout test results Json's to create the dashboard
for json_file in results_directories:
- with open(self._filesystem.join(json_file, 'failing_results.json'), "r") as file:
+ with open(self._filesystem.join(json_file, 'failing_results.json'), 'r') as file:
json_string = file.readline()
json_string = json_string[12:-2] # Remove preceeding string ADD_RESULTS( and ); at the end
self._old_failing_results_list.append(json.loads(json_string))
- with open(self._filesystem.join(json_file, 'full_results.json'), "r") as full_file:
+ with open(self._filesystem.join(json_file, 'full_results.json'), 'r') as full_file:
json_string_full_result = full_file.readline()
self._old_full_results_list.append(json.loads(json_string_full_result))
self._copy_dashboard_html()
def generate(self):
self._initialize()
- process_json_data = ProcessJsonData(self._current_result_json_dict, self._old_failing_results_list, self._old_full_results_list)
+ process_json_data = ProcessJsonData(
+ self._current_result_json_dict,
+ self._old_failing_results_list,
+ self._old_full_results_list)
self._final_result = process_json_data.generate_archived_result()
final_json = json.dumps(self._final_result)
final_json = 'ADD_RESULTS(' + final_json + ');'
- with open(self._filesystem.join(self._results_directory, 'archived_results.json'), "w") as file:
+ with open(self._filesystem.join(self._results_directory, 'archived_results.json'), 'w') as file:
file.write(final_json)

Powered by Google App Engine
This is Rietveld 408576698