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
parent 32f2dfb642
commit 997253f286
11 changed files with 32 additions and 8 deletions

View File

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # 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 os
import re import re

View File

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # 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 import os
from argparse import Namespace from argparse import Namespace

View File

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

View File

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # 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 os
import re import re

View File

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

View File

@ -2,7 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # 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 os
import posixpath import posixpath

View File

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

View File

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

View File

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

View File

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

View File

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