Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/print-stale-test-expectations-entries |
| diff --git a/third_party/WebKit/Tools/Scripts/print-stale-test-expectations-entries b/third_party/WebKit/Tools/Scripts/print-stale-test-expectations-entries |
| index d868e01981929b21a353ed37fa8c4e021251e385..c457afbd179da134e12ecf1275fb3b843c0b5966 100755 |
| --- a/third_party/WebKit/Tools/Scripts/print-stale-test-expectations-entries |
| +++ b/third_party/WebKit/Tools/Scripts/print-stale-test-expectations-entries |
| @@ -42,7 +42,7 @@ from webkitpy.layout_tests.models.test_expectations import TestExpectationParser |
| # FIXME: Make this a direct request to Monorail. |
| GOOGLE_CODE_URL = 'https://www.googleapis.com/projecthosting/v2/projects/chromium/issues/%s?key=AIzaSyDgCqT1Dt5AZWLHo4QJjyMHaCjhnFacGF0' |
| CRBUG_PREFIX = 'crbug.com/' |
| - |
| +CSV_ROW_HEADERS = 'crbug link, test file, days since last updated, status\n' |
|
qyearsley
2016/08/19 00:37:18
This would also make sense as a list of strings:
nainar
2016/08/19 03:36:48
Done.
|
| class StaleTestPrinter(object): |
| @@ -51,6 +51,8 @@ class StaleTestPrinter(object): |
| self.csv_filename = options.create_csv |
| self.host = Host() |
| self.is_stale_results = {} |
| + self.last_updated = {} |
| + self.state = {} |
| def print_stale_tests(self): |
| port = self.host.port_factory.get() |
| @@ -67,8 +69,11 @@ class StaleTestPrinter(object): |
| self.write_csv(csv_rows) |
| def write_csv(self, rows): |
| + # TODO(nainar): Add following to CSV |
| + # - Add days since last comment |
| + # - Add whether or not the bug is closed |
| row_strings = [', '.join(r) for r in rows] |
| - contents = '\n'.join(row_strings) + '\n' |
| + contents = CSV_ROW_HEADERS + '\n'.join(row_strings) + '\n' |
| self.host.filesystem.write_text_file(self.csv_filename, contents) |
|
qyearsley
2016/08/19 00:37:18
Note: this function could also be implemented with
nainar
2016/08/19 03:36:48
Done.
|
| def check_expectations_line(self, line): |
| @@ -84,7 +89,7 @@ class StaleTestPrinter(object): |
| try: |
| if bug_links and all(self.is_stale(bug_link) for bug_link in bug_links): |
| print line.original_string.strip() |
| - return [bug_links[0], test_name] |
| + return [bug_links[0], test_name, str(self.last_updated[bug_links[0]]), self.state[bug_links[0]]] |
| except urllib2.HTTPError as error: |
| if error.code == 404: |
| message = 'got 404, bug does not exist.' |
| @@ -108,6 +113,8 @@ class StaleTestPrinter(object): |
| parsed_time = datetime.datetime.strptime(last_updated.split(".")[0] + "UTC", "%Y-%m-%dT%H:%M:%S%Z") |
| time_delta = datetime.datetime.now() - parsed_time |
| self.is_stale_results[bug_link] = time_delta.days > self.days |
| + self.last_updated[bug_link] = time_delta.days |
| + self.state[bug_link] = parsed['state'] |
|
qyearsley
2016/08/19 00:37:18
It seems like storing the state of the bug isn't c
nainar
2016/08/19 03:36:48
Have done the refactors you have asked for.
|
| return self.is_stale_results[bug_link] |