Bug 1559975 - Make layout/tools/reftest lint with 'py2' and 'py3' r=catlee

Depends on D36093

Differential Revision: https://phabricator.services.mozilla.com/D36094

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Justin Wood 2019-12-26 21:17:55 +00:00
Родитель 32f2dfb642
Коммит 997253f286
11 изменённых файлов: 32 добавлений и 8 удалений

Просмотреть файл

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import os
import re

Просмотреть файл

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals, print_function
import os
from argparse import Namespace

Просмотреть файл

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import json
import threading
from collections import defaultdict

Просмотреть файл

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import unicode_literals
from __future__ import unicode_literals, absolute_import, print_function
import os
import re

Просмотреть файл

@ -1,3 +1,5 @@
from __future__ import absolute_import, print_function
import argparse
import os
from collections import OrderedDict

Просмотреть файл

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function
from __future__ import absolute_import, print_function
import os
import posixpath

Просмотреть файл

@ -7,6 +7,8 @@ Runs the reftest test harness.
"""
from __future__ import print_function
from __future__ import absolute_import, print_function
import copy
import json
import multiprocessing
@ -82,6 +84,18 @@ summaryLines = [('Successful', [('pass', 'pass'), ('loadOnly', 'load only')]),
('slow', 'slow')])]
if sys.version_info[0] == 3:
def reraise_(tp_, value_, tb_=None):
if value_ is None:
value_ = tp_()
if value_.__traceback__ is not tb_:
raise value_.with_traceback(tb_)
raise value_
else:
exec("def reraise_(tp_, value_, tb_=None):\n raise tp_, value_, tb_\n")
def update_mozinfo():
"""walk up directories to find mozinfo.json update the info"""
# TODO: This should go in a more generic place, e.g. mozinfo
@ -116,7 +130,7 @@ class ReftestThread(threading.Thread):
process = subprocess.Popen(self.cmdargs, stdout=subprocess.PIPE)
for chunk in self.chunkForMergedOutput(process.stdout):
with printLock:
print(chunk,)
print(chunk, end=' ')
sys.stdout.flush()
self.retcode = process.wait()
@ -671,8 +685,9 @@ class RefTest(object):
for (summaryObj, (text, categories)) in zip(summaryObjects, summaryLines):
details = ', '.join(["%d %s" % (summaryObj[attribute], description) for (
attribute, description) in categories])
print('REFTEST INFO | ' + text + ': ' + str(summaryObj['total']) +
' (' + details + ')')
print(
'REFTEST INFO | ' + text + ': ' + str(summaryObj['total']) + ' (' + details + ')'
)
return int(any(t.retcode != 0 for t in threads))

Просмотреть файл

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import json
import os
from argparse import Namespace

Просмотреть файл

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import mozunit
import pytest

Просмотреть файл

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import os
from cStringIO import StringIO
from functools import partial

Просмотреть файл

@ -10,7 +10,6 @@ py3:
- ipc/ipdl
- layout/reftests
- layout/style/ServoCSSPropList.mako.py
- layout/tools/reftest
- security/manager/ssl
- testing/awsy
- testing/condprofile/condprof/android.py