Title: [234856] trunk/Tools
Revision
234856
Author
[email protected]
Date
2018-08-14 10:54:56 -0700 (Tue, 14 Aug 2018)

Log Message

Enhancement request: Make export-w3c-test-changes add the PR to "See Also" links
https://bugs.webkit.org/show_bug.cgi?id=186140

Patch by Darshan Kadu <[email protected]> on 2018-08-14
Reviewed by Youenn Fablet.

Added an optional parameter see_also to post_comment_to_bug function and used it for adding see_also variable's content in "See Also"
* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla.post_comment_to_bug):
Modified mock for see_also parameter
* Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py:
(MockBugzilla.post_comment_to_bug):
Made following unit tests to have see_also in bug comment
* Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
* Scripts/webkitpy/tool/bot/sheriff_unittest.py:
(SheriffTest.test_post_blame_comment_on_bug):
* Scripts/webkitpy/tool/commands/applywatchlistlocal_unittest.py:
* Scripts/webkitpy/tool/commands/queues_unittest.py:
* Scripts/webkitpy/tool/commands/upload_unittest.py:
* Scripts/webkitpy/tool/steps/applywatchlist_unittest.py:
* Scripts/webkitpy/w3c/test_exporter.py:
(WebPlatformTestExporter.make_pull_request):
* Scripts/webkitpy/w3c/test_exporter_unittest.py:
(TestExporterTest.MockBugzilla.post_comment_to_bug):
(TestExporterTest.test_export):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (234855 => 234856)


--- trunk/Tools/ChangeLog	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/ChangeLog	2018-08-14 17:54:56 UTC (rev 234856)
@@ -1,3 +1,30 @@
+2018-08-14  Darshan Kadu  <[email protected]>
+
+        Enhancement request: Make export-w3c-test-changes add the PR to "See Also" links
+        https://bugs.webkit.org/show_bug.cgi?id=186140
+
+        Reviewed by Youenn Fablet.
+
+        Added an optional parameter see_also to post_comment_to_bug function and used it for adding see_also variable's content in "See Also"
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla.post_comment_to_bug):
+        Modified mock for see_also parameter
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py:
+        (MockBugzilla.post_comment_to_bug):
+        Made following unit tests to have see_also in bug comment
+        * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
+        * Scripts/webkitpy/tool/bot/sheriff_unittest.py:
+        (SheriffTest.test_post_blame_comment_on_bug):
+        * Scripts/webkitpy/tool/commands/applywatchlistlocal_unittest.py:
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        * Scripts/webkitpy/tool/commands/upload_unittest.py:
+        * Scripts/webkitpy/tool/steps/applywatchlist_unittest.py:
+        * Scripts/webkitpy/w3c/test_exporter.py:
+        (WebPlatformTestExporter.make_pull_request):
+        * Scripts/webkitpy/w3c/test_exporter_unittest.py:
+        (TestExporterTest.MockBugzilla.post_comment_to_bug):
+        (TestExporterTest.test_export):
+
 2018-08-14  Aakash Jain  <[email protected]>
 
         [ews-build] Add support for max_builds parameter for workers

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -860,7 +860,7 @@
         self.browser["keywords"] = keyword
         self.browser.submit()
 
-    def post_comment_to_bug(self, bug_id, comment_text, cc=None):
+    def post_comment_to_bug(self, bug_id, comment_text, cc=None, see_also=None):
         self.authenticate()
 
         _log.info("Adding comment to bug %s" % bug_id)
@@ -867,6 +867,9 @@
         self.open_url(self.bug_url_for_bug_id(bug_id))
         self.browser.select_form(name="changeform")
         self.browser["comment"] = comment_text
+        if see_also:
+            _log.info("Adding PR link to See Also List for bug %s" % bug_id)
+            self.browser["see_also"] = ", ".join(see_also)
         if cc:
             self.browser["newcc"] = ", ".join(cc)
         self.browser.submit()

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -468,9 +468,9 @@
         _log.info("MOCK setting flag '%s' to '%s' on attachment '%s' with comment '%s'" % (
                   flag_name, flag_value, attachment_id, comment_text))
 
-    def post_comment_to_bug(self, bug_id, comment_text, cc=None):
-        _log.info("MOCK bug comment: bug_id=%s, cc=%s\n--- Begin comment ---\n%s\n--- End comment ---\n" % (
-                  bug_id, cc, comment_text))
+    def post_comment_to_bug(self, bug_id, comment_text, cc=None, see_also=None):
+        _log.info("MOCK bug comment: bug_id=%s, cc=%s, see_also=%s\n--- Begin comment ---\n%s\n--- End comment ---\n" % (
+                  bug_id, cc, see_also, comment_text))
 
     def add_attachment_to_bug(self, bug_id, file_or_string, description, filename=None, comment_text=None, mimetype=None):
         _log.info("MOCK add_attachment_to_bug: bug_id=%s, description=%s filename=%s mimetype=%s" %

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -127,7 +127,7 @@
 cc: [email protected]
 blocked: 50856
 MOCK add_attachment_to_bug: bug_id=60001, description=Failure diff from mock-bot-id filename=failure.diff mimetype=None
-MOCK bug comment: bug_id=50000, cc=None
+MOCK bug comment: bug_id=50000, cc=None, see_also=None
 --- Begin comment ---
 The dummy-queue encountered the following flaky tests while processing attachment 10000:
 

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -65,12 +65,12 @@
             sheriff.post_blame_comment_on_bug(commit_info, builders, ["mock-test-1"])
             sheriff.post_blame_comment_on_bug(commit_info, builders, ["mock-test-1", "mock-test-2"])
 
-        expected_logs = u"""MOCK bug comment: bug_id=1234, cc=['[email protected]']
+        expected_logs = u"""MOCK bug comment: bug_id=1234, cc=['[email protected]'], see_also=None
 --- Begin comment ---
 https://trac.webkit.org/changeset/4321 might have broken Foo and Bar
 --- End comment ---
 
-MOCK bug comment: bug_id=1234, cc=['[email protected]']
+MOCK bug comment: bug_id=1234, cc=['[email protected]'], see_also=None
 --- Begin comment ---
 https://trac.webkit.org/changeset/4321 might have broken Foo and Bar
 The following tests are not passing:
@@ -77,7 +77,7 @@
 mock-test-1
 --- End comment ---
 
-MOCK bug comment: bug_id=1234, cc=['[email protected]']
+MOCK bug comment: bug_id=1234, cc=['[email protected]'], see_also=None
 --- Begin comment ---
 https://trac.webkit.org/changeset/4321 might have broken Foo and Bar
 The following tests are not passing:

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/applywatchlistlocal_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/tool/commands/applywatchlistlocal_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/applywatchlistlocal_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -43,7 +43,7 @@
 
     def test_args_parsing_with_bug(self):
         expected_logs = """MockWatchList: determine_cc_and_messages
-MOCK bug comment: bug_id=50002, cc=set(['[email protected]', '[email protected]', '[email protected]'])
+MOCK bug comment: bug_id=50002, cc=set(['[email protected]', '[email protected]', '[email protected]']), see_also=None
 --- Begin comment ---
 Message1.
 

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -424,7 +424,7 @@
 
     def test_report_flaky_tests(self):
         queue = TestCommitQueue(MockTool())
-        expected_logs = """MOCK bug comment: bug_id=50002, cc=None
+        expected_logs = """MOCK bug comment: bug_id=50002, cc=None, see_also=None
 --- Begin comment ---
 The commit-queue just saw foo/bar.html flake (text diff) while processing attachment 10000 on bug 50000.
 Port: MockPort  Platform: MockPlatform 1.0
@@ -431,7 +431,7 @@
 --- End comment ---
 
 MOCK add_attachment_to_bug: bug_id=50002, description=Failure diff from bot filename=failure.diff mimetype=None
-MOCK bug comment: bug_id=50002, cc=None
+MOCK bug comment: bug_id=50002, cc=None, see_also=None
 --- Begin comment ---
 The commit-queue just saw bar/baz.html flake (text diff) while processing attachment 10000 on bug 50000.
 Port: MockPort  Platform: MockPlatform 1.0
@@ -439,7 +439,7 @@
 
 bar/baz-diffs.txt does not exist in results archive, uploading entire archive.
 MOCK add_attachment_to_bug: bug_id=50002, description=Archive of layout-test-results from bot filename=layout-test-results.zip mimetype=None
-MOCK bug comment: bug_id=50000, cc=None
+MOCK bug comment: bug_id=50000, cc=None, see_also=None
 --- Begin comment ---
 The commit-queue encountered the following flaky tests while processing attachment 10000:
 

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -194,7 +194,7 @@
 MOCK: user.open_url: http://example.com/50000
 Is this correct?
 Adding comment to Bug 50000.
-MOCK bug comment: bug_id=50000, cc=None
+MOCK bug comment: bug_id=50000, cc=None, see_also=None
 --- Begin comment ---
 MOCK comment
 

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/applywatchlist_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/tool/steps/applywatchlist_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/applywatchlist_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -42,7 +42,7 @@
             'diff': 'The diff',
         }
         expected_logs = """MockWatchList: determine_cc_and_messages
-MOCK bug comment: bug_id=50001, cc=set(['[email protected]'])
+MOCK bug comment: bug_id=50001, cc=set(['[email protected]']), see_also=None
 --- Begin comment ---
 Message2.
 --- End comment ---

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -324,7 +324,8 @@
                 _log.warning(e)
                 _log.info('Could not add label "%s" to pr #%s. User "%s" may not have permission to update labels in the %s/%s repo.' % (WEBKIT_EXPORT_PR_LABEL, pr_number, self.username, WPT_GH_ORG, WPT_GH_REPO_NAME))
         if self._bug_id and pr_number:
-            self._bugzilla.post_comment_to_bug(self._bug_id, "Submitted web-platform-tests pull request: " + WPT_PR_URL + str(pr_number))
+            pr_url = WPT_PR_URL + str(pr_number)
+            self._bugzilla.post_comment_to_bug(self._bug_id, "Submitted web-platform-tests pull request: " + pr_url, see_also=[pr_url])
 
     def create_wpt_pull_request(self, remote_branch_name, title, body):
         pr_number = None

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py (234855 => 234856)


--- trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py	2018-08-14 17:46:35 UTC (rev 234855)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py	2018-08-14 17:54:56 UTC (rev 234856)
@@ -41,7 +41,9 @@
             self.calls.append('fetch bug ' + id)
             return {"title": "my bug title"}
 
-        def post_comment_to_bug(self, id, comment):
+        def post_comment_to_bug(self, id, comment, see_also=None):
+            if see_also:
+                self.calls.append("Append %s to see also list" % ", ".join(see_also))
             self.calls.append('post comment to bug ' + id + ' : ' + comment)
             return True
 
@@ -148,6 +150,7 @@
             'reset hard origin/master'])
         self.assertEquals(exporter._bugzilla.calls, [
             'fetch bug 1234',
+            'Append https://github.com/web-platform-tests/wpt/pull/5678 to see also list',
             'post comment to bug 1234 : Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/5678'])
         self.assertEquals(mock_linter.calls, ['/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests', 'lint'])
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to