Title: [251491] trunk/Tools
Revision
251491
Author
jbed...@apple.com
Date
2019-10-23 13:02:05 -0700 (Wed, 23 Oct 2019)

Log Message

Python 3: Add support in webkitpy.results
https://bugs.webkit.org/show_bug.cgi?id=202478

Reviewed by Carlos Alberto Lopez Perez.

* Scripts/test-webkitpy-python3: Add webkitpy.results.
* Scripts/webkitpy/results/upload.py:
(Upload.Encoder.default): Use range instead of xrange.
(Upload.create_configuration): Support items iteration for Python 3.
(Upload.create_run_stats): Change iteritems to items.
(Upload.create_test_result): Ditto.
* Scripts/webkitpy/results/upload_unittest.py:
(UploadTest.Options.__init__): Change iteritems to items.
(UploadTest.normalize): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (251490 => 251491)


--- trunk/Tools/ChangeLog	2019-10-23 19:41:09 UTC (rev 251490)
+++ trunk/Tools/ChangeLog	2019-10-23 20:02:05 UTC (rev 251491)
@@ -1,3 +1,20 @@
+2019-10-23  Jonathan Bedard  <jbed...@apple.com>
+
+        Python 3: Add support in webkitpy.results
+        https://bugs.webkit.org/show_bug.cgi?id=202478
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * Scripts/test-webkitpy-python3: Add webkitpy.results.
+        * Scripts/webkitpy/results/upload.py:
+        (Upload.Encoder.default): Use range instead of xrange.
+        (Upload.create_configuration): Support items iteration for Python 3.
+        (Upload.create_run_stats): Change iteritems to items.
+        (Upload.create_test_result): Ditto.
+        * Scripts/webkitpy/results/upload_unittest.py:
+        (UploadTest.Options.__init__): Change iteritems to items.
+        (UploadTest.normalize): Ditto.
+
 2019-10-22  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]

Modified: trunk/Tools/Scripts/test-webkitpy-python3 (251490 => 251491)


--- trunk/Tools/Scripts/test-webkitpy-python3	2019-10-23 19:41:09 UTC (rev 251490)
+++ trunk/Tools/Scripts/test-webkitpy-python3	2019-10-23 20:02:05 UTC (rev 251491)
@@ -37,6 +37,7 @@
   'webkitpy.common.thread',
   'webkitpy.common.net',
   'webkitpy.common.watchlist',
+  'webkitpy.results',
 ]
 
 

Modified: trunk/Tools/Scripts/webkitpy/results/upload.py (251490 => 251491)


--- trunk/Tools/Scripts/webkitpy/results/upload.py	2019-10-23 19:41:09 UTC (rev 251490)
+++ trunk/Tools/Scripts/webkitpy/results/upload.py	2019-10-23 20:02:05 UTC (rev 251491)
@@ -69,7 +69,7 @@
             buildbot_args = [details.get(arg, None) is None for arg in obj.BUILDBOT_DETAILS]
             if any(buildbot_args) and not all(buildbot_args):
                 raise ValueError('All buildbot details must be defined for upload, details missing: {}'.format(', '.join(
-                    [obj.BUILDBOT_DETAILS[i] for i in xrange(len(obj.BUILDBOT_DETAILS)) if buildbot_args[i]],
+                    [obj.BUILDBOT_DETAILS[i] for i in range(len(obj.BUILDBOT_DETAILS)) if buildbot_args[i]],
                 )))
 
             def unpack_test(current, path_to_test, data):
@@ -81,9 +81,15 @@
                 unpack_test(current[path_to_test[0]], path_to_test[1:], data)
 
             results = {}
-            for test, data in obj.results.iteritems():
-                unpack_test(results, test.split('/'), data)
 
+            # FIXME: Python 2 removal, this dictionary is large enough that Python 2 can't just use items
+            if sys.version_info > (3, 0):
+                for test, data in obj.results.items():
+                    unpack_test(results, test.split('/'), data)
+            else:
+                for test, data in obj.results.iteritems():
+                    unpack_test(results, test.split('/'), data)
+
             result = dict(
                 version=obj.VERSION,
                 suite=obj.suite,
@@ -129,7 +135,7 @@
             architecture=architecture or host_platform.machine(),
         )
         optional_data = dict(version_name=version_name, model=model, style=style, flavor=flavor, sdk=sdk)
-        config.update({key: value for key, value in optional_data.iteritems() if value is not None})
+        config.update({key: value for key, value in optional_data.items() if value is not None})
         return config
 
     @staticmethod
@@ -157,7 +163,7 @@
     def create_run_stats(start_time=None, end_time=None, tests_skipped=None, **kwargs):
         stats = dict(**kwargs)
         optional_data = dict(start_time=start_time, end_time=end_time, tests_skipped=tests_skipped)
-        stats.update({key: value for key, value in optional_data.iteritems() if value is not None})
+        stats.update({key: value for key, value in optional_data.items() if value is not None})
         return stats
 
     @staticmethod
@@ -166,7 +172,7 @@
 
         # Tests which don't declare expectations or results are assumed to have passed.
         optional_data = dict(expected=expected, actual=actual, log=log)
-        result.update({key: value for key, value in optional_data.iteritems() if value is not None})
+        result.update({key: value for key, value in optional_data.items() if value is not None})
         return result
 
     def upload(self, hostname, log_line_func=lambda val: sys.stdout.write(val + '\n')):

Modified: trunk/Tools/Scripts/webkitpy/results/upload_unittest.py (251490 => 251491)


--- trunk/Tools/Scripts/webkitpy/results/upload_unittest.py	2019-10-23 19:41:09 UTC (rev 251490)
+++ trunk/Tools/Scripts/webkitpy/results/upload_unittest.py	2019-10-23 20:02:05 UTC (rev 251491)
@@ -25,6 +25,7 @@
 import collections
 import json
 import requests
+import sys
 import time
 import unittest
 
@@ -31,12 +32,15 @@
 from webkitpy.results.upload import Upload
 from webkitpy.thirdparty import mock
 
+if sys.version_info > (3, 0):
+    basestring = str
 
+
 class UploadTest(unittest.TestCase):
 
     class Options(object):
         def __init__(self, **kwargs):
-            for key, value in kwargs.iteritems():
+            for key, value in kwargs.items():
                 setattr(self, key, value)
 
     class MockResponse(object):
@@ -52,7 +56,7 @@
         if isinstance(data, basestring):
             return str(data)
         elif isinstance(data, collections.Mapping):
-            return dict(map(UploadTest.normalize, data.iteritems()))
+            return dict(map(UploadTest.normalize, data.items()))
         elif isinstance(data, collections.Iterable):
             return type(data)(map(UploadTest.normalize, data))
         return data
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to