mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1397855 - Enable py2 and py3 linter on testing/xpcshell. r=ahal
MozReview-Commit-ID: CsfIcI1ma7J --HG-- extra : rebase_source : 53658c33432927f72ddce0999f18c2b7df261f6d
This commit is contained in:
parent
c3c1749786
commit
5934392346
@ -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
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@ -4,6 +4,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 logging
|
||||
import posixpath
|
||||
import sys, os
|
||||
@ -168,7 +170,7 @@ class RemoteXPCShellTestThread(xpcshell.XPCShellTestThread):
|
||||
# The minidumps directory is automatically created when Fennec
|
||||
# (first) starts, so its lack of presence is a hint that
|
||||
# something went wrong.
|
||||
print "Automation Error: No crash directory (%s) found on remote device" % self.remoteMinidumpDir
|
||||
print("Automation Error: No crash directory (%s) found on remote device" % self.remoteMinidumpDir)
|
||||
# Whilst no crash was found, the run should still display as a failure
|
||||
return True
|
||||
with mozfile.TemporaryDirectory() as dumpDir:
|
||||
@ -275,7 +277,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
elif os.path.isdir(os.path.join(here, 'tests')):
|
||||
self.xpcDir = os.path.join(here, 'tests')
|
||||
else:
|
||||
print >> sys.stderr, "Couldn't find local xpcshell test directory"
|
||||
print("Couldn't find local xpcshell test directory", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if options['localAPK']:
|
||||
@ -375,7 +377,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
if packageName:
|
||||
self.appRoot = self.device.getAppRoot(packageName.strip())
|
||||
except Exception as detail:
|
||||
print "unable to determine app root: " + str(detail)
|
||||
print("unable to determine app root: " + str(detail))
|
||||
pass
|
||||
return None
|
||||
|
||||
@ -417,11 +419,11 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
for fname in binaries:
|
||||
local = os.path.join(self.localBin, fname)
|
||||
if os.path.isfile(local):
|
||||
print >> sys.stderr, "Pushing %s.." % fname
|
||||
print("Pushing %s.." % fname, file=sys.stderr)
|
||||
remoteFile = remoteJoin(self.remoteBinDir, fname)
|
||||
self.device.pushFile(local, remoteFile)
|
||||
else:
|
||||
print >> sys.stderr, "*** Expected binary %s not found in %s!" % (fname, self.localBin)
|
||||
print("*** Expected binary %s not found in %s!" % (fname, self.localBin), file=sys.stderr)
|
||||
|
||||
local = os.path.join(self.localBin, "components/httpd.js")
|
||||
remoteFile = remoteJoin(self.remoteComponentsDir, "httpd.js")
|
||||
@ -448,7 +450,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
dir = tempfile.mkdtemp()
|
||||
for info in self.localAPKContents.infolist():
|
||||
if info.filename.endswith(".so"):
|
||||
print >> sys.stderr, "Pushing %s.." % info.filename
|
||||
print("Pushing %s.." % info.filename, file=sys.stderr)
|
||||
remoteFile = remoteJoin(self.remoteBinDir, os.path.basename(info.filename))
|
||||
self.localAPKContents.extract(info, dir)
|
||||
localFile = os.path.join(dir, info.filename)
|
||||
@ -467,9 +469,9 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
|
||||
for file in os.listdir(self.localLib):
|
||||
if (file.endswith(".so")):
|
||||
print >> sys.stderr, "Pushing %s.." % file
|
||||
print("Pushing %s.." % file, file=sys.stderr)
|
||||
if 'libxul' in file:
|
||||
print >> sys.stderr, "This is a big file, it could take a while."
|
||||
print("This is a big file, it could take a while.", file=sys.stderr)
|
||||
localFile = os.path.join(self.localLib, file)
|
||||
remoteFile = remoteJoin(self.remoteBinDir, file)
|
||||
self.device.pushFile(localFile, remoteFile)
|
||||
@ -481,7 +483,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
for root, dirs, files in os.walk(localArmLib):
|
||||
for file in files:
|
||||
if (file.endswith(".so")):
|
||||
print >> sys.stderr, "Pushing %s.." % file
|
||||
print("Pushing %s.." % file, file=sys.stderr)
|
||||
localFile = os.path.join(root, file)
|
||||
remoteFile = remoteJoin(self.remoteBinDir, file)
|
||||
self.device.pushFile(localFile, remoteFile)
|
||||
@ -494,7 +496,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
||||
self.device.pushDir(self.testingModulesDir, self.remoteModulesDir)
|
||||
|
||||
def setupTestDir(self):
|
||||
print 'pushing %s' % self.xpcDir
|
||||
print('pushing %s' % self.xpcDir)
|
||||
try:
|
||||
# The tests directory can be quite large: 5000 files and growing!
|
||||
# Sometimes - like on a low-end aws instance running an emulator - the push
|
||||
@ -562,7 +564,7 @@ class PathMapping:
|
||||
|
||||
def main():
|
||||
if sys.version_info < (2,7):
|
||||
print >>sys.stderr, "Error: You must use python version 2.7 or newer but less than 3.0"
|
||||
print("Error: You must use python version 2.7 or newer but less than 3.0", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
parser = parser_remote()
|
||||
@ -572,10 +574,10 @@ def main():
|
||||
if (file.endswith(".apk") and file.startswith("fennec")):
|
||||
options.localAPK = os.path.join(options.objdir, "dist")
|
||||
options.localAPK = os.path.join(options.localAPK, file)
|
||||
print >>sys.stderr, "using APK: " + options.localAPK
|
||||
print("using APK: " + options.localAPK, file=sys.stderr)
|
||||
break
|
||||
else:
|
||||
print >>sys.stderr, "Error: please specify an APK"
|
||||
print("Error: please specify an APK", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
options = verifyRemoteOptions(parser, options)
|
||||
@ -592,7 +594,7 @@ def main():
|
||||
dm = mozdevice.DroidADB(**dm_args)
|
||||
|
||||
if options['interactive'] and not options['testPath']:
|
||||
print >>sys.stderr, "Error: You must specify a test filename in interactive mode!"
|
||||
print("Error: You must specify a test filename in interactive mode!", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if options['xpcshell'] is None:
|
||||
|
@ -4,6 +4,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 copy
|
||||
import importlib
|
||||
import json
|
||||
@ -1068,7 +1070,7 @@ class XPCShellTests(object):
|
||||
searchObj = re.search( r'HTTP2 server listening on port (.*)', msg, 0)
|
||||
if searchObj:
|
||||
self.env["MOZHTTP2_PORT"] = searchObj.group(1)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
# This occurs if the subprocess couldn't be started
|
||||
self.log.error('Could not run %s server: %s' % (name, str(e)))
|
||||
raise
|
||||
|
@ -4,6 +4,8 @@
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import mozinfo
|
||||
import mozunit
|
||||
import os
|
||||
@ -1084,7 +1086,7 @@ add_test({
|
||||
try:
|
||||
# The actual return value is never checked because we raise.
|
||||
self.assertTestResult(True)
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
raised = True
|
||||
self.assertEquals(ex.message[0:9], "head file")
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import argparse
|
||||
|
||||
from mozlog import commandline
|
||||
|
@ -50,7 +50,6 @@ py2:
|
||||
- testing/tools
|
||||
- testing/tps
|
||||
- testing/web-platform
|
||||
- testing/xpcshell
|
||||
- third_party
|
||||
- toolkit
|
||||
- tools/docs
|
||||
|
Loading…
Reference in New Issue
Block a user