Title: [251374] trunk/Tools
Revision
251374
Author
[email protected]
Date
2019-10-21 12:34:53 -0700 (Mon, 21 Oct 2019)

Log Message

Python 3: Add support in webkitpy.common.net
https://bugs.webkit.org/show_bug.cgi?id=202464

Reviewed by Dewei Zhu.

* Scripts/test-webkitpy-python3: Add webkitpy.common.net.
* Scripts/webkitpy/common/net/credentials_unittest.py: Replace raw_input with input for Python3.
* Scripts/webkitpy/common/net/ewsserver.py:
* Scripts/webkitpy/common/net/resultsjsonparser.py:
(ParsedJSONResults.__init__): Sort results by test name.
* Scripts/webkitpy/common/net/resultsjsonparser_unittest.py:
(test_basic): Sort results by test name.
* Scripts/webkitpy/common/net/statusserver.py:
(StatusServer._fetch_url):
* Scripts/webkitpy/common/net/unittestresults_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (251373 => 251374)


--- trunk/Tools/ChangeLog	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/ChangeLog	2019-10-21 19:34:53 UTC (rev 251374)
@@ -1,3 +1,21 @@
+2019-10-21  Jonathan Bedard  <[email protected]>
+
+        Python 3: Add support in webkitpy.common.net
+        https://bugs.webkit.org/show_bug.cgi?id=202464
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/test-webkitpy-python3: Add webkitpy.common.net.
+        * Scripts/webkitpy/common/net/credentials_unittest.py: Replace raw_input with input for Python3.
+        * Scripts/webkitpy/common/net/ewsserver.py:
+        * Scripts/webkitpy/common/net/resultsjsonparser.py:
+        (ParsedJSONResults.__init__): Sort results by test name.
+        * Scripts/webkitpy/common/net/resultsjsonparser_unittest.py:
+        (test_basic): Sort results by test name.
+        * Scripts/webkitpy/common/net/statusserver.py:
+        (StatusServer._fetch_url):
+        * Scripts/webkitpy/common/net/unittestresults_unittest.py:
+
 2019-10-18  Aakash Jain  <[email protected]>
 
         EWS should have a way to retry a patch

Modified: trunk/Tools/Scripts/test-webkitpy-python3 (251373 => 251374)


--- trunk/Tools/Scripts/test-webkitpy-python3	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/test-webkitpy-python3	2019-10-21 19:34:53 UTC (rev 251374)
@@ -34,9 +34,7 @@
 PYTHON3_COMPATIBLE_DIRECTORIES = [
   'webkitpy.common.system',
   'webkitpy.common.thread',
-  'webkitpy.common.net.bugzilla',
-  'webkitpy.common.net.buildbot',
-  'webkitpy.common.net.irc',
+  'webkitpy.common.net',
   'webkitpy.common.watchlist',
 ]
 

Modified: trunk/Tools/Scripts/webkitpy/common/net/credentials_unittest.py (251373 => 251374)


--- trunk/Tools/Scripts/webkitpy/common/net/credentials_unittest.py	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/webkitpy/common/net/credentials_unittest.py	2019-10-21 19:34:53 UTC (rev 251374)
@@ -1,4 +1,5 @@
 # Copyright (C) 2009 Google Inc. All rights reserved.
+# Copyright (C) 2019 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -27,6 +28,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
+import sys
 import tempfile
 import unittest
 
@@ -37,7 +39,12 @@
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive
 
+if sys.version_info > (3, 0):
+    input_func = input
+else:
+    input_func = raw_input
 
+
 # FIXME: Other unit tests probably want this class.
 class _TemporaryDirectory(object):
     def __init__(self, **kwargs):
@@ -193,11 +200,11 @@
 
         class FakeUser(MockUser):
             @classmethod
-            def prompt(cls, message, repeat=1, raw_input=raw_input):
+            def prompt(cls, message, repeat=1, raw_input=input_func):
                 return "[email protected]"
 
             @classmethod
-            def prompt_password(cls, message, repeat=1, raw_input=raw_input):
+            def prompt_password(cls, message, repeat=1, raw_input=input_func):
                 raise AssertionError("should not prompt for password")
 
         with _TemporaryDirectory(suffix="not_a_git_repo") as temp_dir_path:
@@ -223,11 +230,11 @@
 
         class FakeUser(MockUser):
             @classmethod
-            def prompt(cls, message, repeat=1, raw_input=raw_input):
+            def prompt(cls, message, repeat=1, raw_input=input_func):
                 return "[email protected]"
 
             @classmethod
-            def prompt_password(cls, message, repeat=1, raw_input=raw_input):
+            def prompt_password(cls, message, repeat=1, raw_input=input_func):
                 return "NOMNOMNOM"
 
         with _TemporaryDirectory(suffix="not_a_git_repo") as temp_dir_path:

Modified: trunk/Tools/Scripts/webkitpy/common/net/ewsserver.py (251373 => 251374)


--- trunk/Tools/Scripts/webkitpy/common/net/ewsserver.py	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/webkitpy/common/net/ewsserver.py	2019-10-21 19:34:53 UTC (rev 251374)
@@ -22,6 +22,7 @@
 
 from webkitpy.common.config.urls import ewsserver_default_host
 from webkitpy.common.net.networktransaction import NetworkTransaction
+from webkitpy.common.unicode_compatibility import unicode
 
 import logging
 

Modified: trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py (251373 => 251374)


--- trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser.py	2019-10-21 19:34:53 UTC (rev 251374)
@@ -1,4 +1,5 @@
 # Copyright (c) 2010, Google Inc. All rights reserved.
+# Copyright (C) 2019 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -162,6 +163,7 @@
                 unexpected_failures.append(test_result)
 
         self._test_results = unexpected_failures
+        self._test_results.sort(key=lambda result: result.test_name)
         self._did_exceed_test_failure_limit = json_dict["interrupted"]
 
     def did_exceed_test_failure_limit(self):

Modified: trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py (251373 => 251374)


--- trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py	2019-10-21 19:34:53 UTC (rev 251374)
@@ -1,4 +1,5 @@
 # Copyright (c) 2010, Google Inc. All rights reserved.
+# Copyright (C) 2019 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -143,11 +144,13 @@
 });"""
 
     def test_basic(self):
+        self.maxDiff = None
         expected_results = [
             test_results.TestResult("svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html", [test_failures.FailureImageHashMismatch()], 0),
             test_results.TestResult("fast/dom/prototype-inheritance.html", [test_failures.FailureTextMismatch(), test_failures.FailureImageHashMismatch(), test_failures.FailureAudioMismatch()], 0),
             test_results.TestResult("fast/dom/prototype-strawberry.html", [test_failures.FailureDocumentLeak(['file:///Volumes/Data/slave/webkit/build/LayoutTests/fast/dom/prototype-strawberry.html'])], 0),
         ]
+        expected_results.sort(key=lambda result: result.test_name)
         parsed_results = ParsedJSONResults(self._example_full_results_json)
         self.assertEqual(expected_results, parsed_results.test_results())
         self.assertTrue(parsed_results.did_exceed_test_failure_limit())

Modified: trunk/Tools/Scripts/webkitpy/common/net/statusserver.py (251373 => 251374)


--- trunk/Tools/Scripts/webkitpy/common/net/statusserver.py	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/webkitpy/common/net/statusserver.py	2019-10-21 19:34:53 UTC (rev 251374)
@@ -29,14 +29,20 @@
 #
 # This the client designed to talk to Tools/QueueStatusServer.
 
+import logging
+import sys
+
 from webkitpy.common.config.urls import statusserver_default_host
 from webkitpy.common.net.bugzilla.attachment import Attachment
 from webkitpy.common.net.networktransaction import NetworkTransaction
+from webkitpy.common.unicode_compatibility import StringIO
 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
 
-import StringIO
-import logging
-import urllib2
+if sys.version_info > (3, 0):
+    from urllib.error import HTTPError
+    from urllib.request import Request, urlopen
+else:
+    from urllib2 import HTTPError, Request, urlopen
 
 _log = logging.getLogger(__name__)
 
@@ -221,11 +227,11 @@
     def _fetch_url(self, url):
         # FIXME: This should use NetworkTransaction's 404 handling instead.
         try:
-            request = urllib2.Request(url)
+            request = Request(url)
             if self._api_key:
                 request.add_header(*self._authorization_header_name_and_value_pair())
-            return urllib2.urlopen(request, timeout=300).read()
-        except urllib2.HTTPError as e:
+            return urlopen(request, timeout=300).read()
+        except HTTPError as e:
             if e.code == 404:
                 return None
             raise e

Modified: trunk/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py (251373 => 251374)


--- trunk/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py	2019-10-21 19:25:52 UTC (rev 251373)
+++ trunk/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py	2019-10-21 19:34:53 UTC (rev 251374)
@@ -1,4 +1,5 @@
 # Copyright (c) 2012, Google Inc. All rights reserved.
+# Copyright (C) 2019 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -28,7 +29,7 @@
 
 import unittest
 
-from unittestresults import UnitTestResults
+from webkitpy.common.net.unittestresults import UnitTestResults
 
 
 class UnitTestResultsTest(unittest.TestCase):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to