diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-10-16 11:01:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-16 11:01:28 -0400 |
commit | 6d488f1be24c1b679931d6d02703f4a10759eb49 (patch) | |
tree | 03ca0c47f6317113825b329e7c25c46a2189156c /python/servo/testing_commands.py | |
parent | bcd8c5e5970182e1eac7cfb1e4f2ab3e23139b1a (diff) | |
parent | 2b3f6a228929a0297f82fff18bfffa98707bb031 (diff) | |
download | servo-6d488f1be24c1b679931d6d02703f4a10759eb49.tar.gz servo-6d488f1be24c1b679931d6d02703f4a10759eb49.zip |
Auto merge of #24435 - marmeladema:issue-23607/compat, r=jdm
Issue 23607: first pass of changes for compatibility with Python3
As much as i want to migrate entirely to Python3 (see #23607), it will require some time as changes in web-platform-tests are significant and rely on upstream fixes to be merged and synced downstream.
In the meantime, lets improve compatibility with Python3 so that later, migration will be less painful.
Build system is definitely not ready yet for Python3, but its a step in the right direction.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x ] `./mach build -d` does not report any errors
- [ x] `./mach test-tidy` does not report any errors
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'python/servo/testing_commands.py')
-rw-r--r-- | python/servo/testing_commands.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 2863c314426..1f7651f814b 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -18,10 +18,11 @@ import copy from collections import OrderedDict import time import json -import urllib2 +import six.moves.urllib as urllib import base64 import shutil import subprocess +from six import iteritems from mach.registrar import Registrar from mach.decorators import ( @@ -59,7 +60,7 @@ TEST_SUITES = OrderedDict([ "include_arg": "test_name"}), ]) -TEST_SUITES_BY_PREFIX = {path: k for k, v in TEST_SUITES.iteritems() if "paths" in v for path in v["paths"]} +TEST_SUITES_BY_PREFIX = {path: k for k, v in iteritems(TEST_SUITES) if "paths" in v for path in v["paths"]} def create_parser_wpt(): @@ -158,7 +159,7 @@ class MachCommands(CommandBase): return 1 test_start = time.time() - for suite, tests in selected_suites.iteritems(): + for suite, tests in iteritems(selected_suites): props = suites[suite] kwargs = props.get("kwargs", {}) if tests: @@ -174,7 +175,7 @@ class MachCommands(CommandBase): def suite_for_path(self, path_arg): if os.path.exists(path.abspath(path_arg)): abs_path = path.abspath(path_arg) - for prefix, suite in TEST_SUITES_BY_PREFIX.iteritems(): + for prefix, suite in iteritems(TEST_SUITES_BY_PREFIX): if abs_path.startswith(prefix): return suite return None @@ -510,9 +511,9 @@ class MachCommands(CommandBase): elif tracker_api.endswith('/'): tracker_api = tracker_api[0:-1] - query = urllib2.quote(failure['test'], safe='') - request = urllib2.Request("%s/query.py?name=%s" % (tracker_api, query)) - search = urllib2.urlopen(request) + query = urllib.parse.quote(failure['test'], safe='') + request = urllib.request.Request("%s/query.py?name=%s" % (tracker_api, query)) + search = urllib.request.urlopen(request) data = json.load(search) if len(data) == 0: actual_failures += [failure] @@ -521,11 +522,11 @@ class MachCommands(CommandBase): else: qstr = "repo:servo/servo+label:I-intermittent+type:issue+state:open+%s" % failure['test'] # we want `/` to get quoted, but not `+` (github's API doesn't like that), so we set `safe` to `+` - query = urllib2.quote(qstr, safe='+') - request = urllib2.Request("https://api.github.com/search/issues?q=%s" % query) + query = urllib.parse.quote(qstr, safe='+') + request = urllib.request.Request("https://api.github.com/search/issues?q=%s" % query) if encoded_auth: request.add_header("Authorization", "Basic %s" % encoded_auth) - search = urllib2.urlopen(request) + search = urllib.request.urlopen(request) data = json.load(search) if data['total_count'] == 0: actual_failures += [failure] |