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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py

Issue 2902523002: Print a suggested commit description after removing flaky lines. (Closed)
Patch Set: add test, sort bugs Created 3 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 | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py
index 0ade6bf2c0acf25754a79f44199b5dcf8039bbf1..bc5929da148f3de51d621bbb288dd0c81c77529e 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations.py
@@ -27,6 +27,7 @@ import argparse
import logging
import webbrowser
+from webkitpy.layout_tests.models.test_expectations import CHROMIUM_BUG_PREFIX
from webkitpy.layout_tests.models.test_expectations import TestExpectations
from webkitpy.tool.commands.flaky_tests import FlakyTests
@@ -51,18 +52,16 @@ def main(host, bot_test_expectations_factory, argv):
_log.warning("Didn't find generic expectations file at: " + expectations_file)
return 1
- remove_flakes_o_matic = RemoveFlakesOMatic(host,
- port,
- bot_test_expectations_factory,
- webbrowser)
+ remove_flakes_o_matic = RemoveFlakesOMatic(
+ host, port, bot_test_expectations_factory, webbrowser)
test_expectations = remove_flakes_o_matic.get_updated_test_expectations()
if args.show_results:
remove_flakes_o_matic.show_removed_results()
- remove_flakes_o_matic.write_test_expectations(test_expectations,
- expectations_file)
+ remove_flakes_o_matic.write_test_expectations(test_expectations, expectations_file)
+ remove_flakes_o_matic.print_suggested_commit_description()
return 0
@@ -319,15 +318,13 @@ class RemoveFlakesOMatic(object):
return test_expectations
def show_removed_results(self):
- """Opens removed lines in the results dashboard.
+ """Opens a browser showing the removed lines in the results dashboard.
- Opens the results dashboard in the browser, showing all the tests for lines that the script
- removed from the TestExpectations file and allowing the user to manually confirm the
- results.
+ Opens the results dashboard in the browser, showing all the tests for
+ lines removed from the TestExpectations file, allowing the user to
+ manually confirm the results.
"""
- removed_test_names = ','.join(x.name for x in self._expectations_to_remove())
- url = FlakyTests.FLAKINESS_DASHBOARD_URL % removed_test_names
-
+ url = self._flakiness_dashboard_url()
_log.info('Opening results dashboard: ' + url)
self._browser.open(url)
@@ -342,3 +339,26 @@ class RemoveFlakesOMatic(object):
self._host.filesystem.write_text_file(
test_expectations_file,
TestExpectations.list_to_string(test_expectations, reconstitute_only_these=[]))
+
+ def print_suggested_commit_description(self):
+ """Prints the body of a suggested CL description after removing some lines."""
+ dashboard_url = self._flakiness_dashboard_url()
+ bugs = ','.join(self._bug_numbers())
+ message = ('Remove flaky TestExpectations for tests which appear non-flaky recently.\n\n'
+ 'This change was made by the update-test-expectations script.\n\n'
+ 'Recent test results history:\n%s\n\n'
+ 'BUG=%s') % (dashboard_url, bugs)
+ _log.info('Suggested commit description:\n' + message)
+
+ def _flakiness_dashboard_url(self):
+ removed_test_names = ','.join(x.name for x in self._expectations_to_remove())
+ return FlakyTests.FLAKINESS_DASHBOARD_URL % removed_test_names
+
+ def _bug_numbers(self):
+ """Returns the list of all bug numbers affected by this change."""
+ numbers = []
+ for line in self._expectations_to_remove():
+ for bug in line.bugs:
+ if bug.startswith(CHROMIUM_BUG_PREFIX):
+ numbers.append(bug[len(CHROMIUM_BUG_PREFIX):])
+ return sorted(numbers)
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/update_test_expectations_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698