Bug 1286312 - cleanup with latest coding style
MozReview-Commit-ID: 2Dt5JMiMkq0
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -46,17 +46,17 @@ from manifestparser.filters import (
pathprefix,
subsuite,
tags,
)
try:
from marionette import Marionette
from marionette_driver.addons import Addons
-except ImportError, e:
+except ImportError as e:
# Defer ImportError until attempt to use Marionette
def reraise(*args, **kwargs):
raise(e)
Marionette = reraise
from leaks import ShutdownLeaks, LSANLeaks
from mochitest_options import (
MochitestArgumentParser, build_obj, get_default_valgrind_suppression_files
@@ -844,17 +844,17 @@ class MochitestDesktop(object):
return test_environment(**kwargs)
def extraPrefs(self, extraPrefs):
"""interpolate extra preferences from option strings"""
try:
return dict(parseKeyValue(extraPrefs, context='--setpref='))
except KeyValueParseError as e:
- print str(e)
+ print(str(e))
sys.exit(1)
def getFullPath(self, path):
" Get an absolute path relative to self.oldcwd."
return os.path.normpath(
os.path.join(
self.oldcwd,
os.path.expanduser(path)))
@@ -2215,17 +2215,17 @@ toolbar#nav-bar {
if not options.runByDir:
return self.runMochitests(options, testsToRun)
# code for --run-by-dir
dirs = self.getDirectories(options)
result = 1 # default value, if no tests are run.
for d in dirs:
- print "dir: %s" % d
+ print("dir: %s" % d)
tests_in_dir = [t for t in testsToRun if os.path.dirname(t) == d]
# If we are using --run-by-dir, we should not use the profile path (if) provided
# by the user, since we need to create a new directory for each run. We would face
# problems if we use the directory provided by the user.
result = self.runMochitests(options, tests_in_dir)
# Dump the logging buffer
@@ -2233,30 +2233,30 @@ toolbar#nav-bar {
if result == -1:
break
e10s_mode = "e10s" if options.e10s else "non-e10s"
# printing total number of tests
if options.flavor == 'browser':
- print "TEST-INFO | checking window state"
- print "Browser Chrome Test Summary"
- print "\tPassed: %s" % self.countpass
- print "\tFailed: %s" % self.countfail
- print "\tTodo: %s" % self.counttodo
- print "\tMode: %s" % e10s_mode
- print "*** End BrowserChrome Test Results ***"
+ print("TEST-INFO | checking window state")
+ print("Browser Chrome Test Summary")
+ print("\tPassed: %s" % self.countpass)
+ print("\tFailed: %s" % self.countfail)
+ print("\tTodo: %s" % self.counttodo)
+ print("\tMode: %s" % e10s_mode)
+ print("*** End BrowserChrome Test Results ***")
else:
- print "0 INFO TEST-START | Shutdown"
- print "1 INFO Passed: %s" % self.countpass
- print "2 INFO Failed: %s" % self.countfail
- print "3 INFO Todo: %s" % self.counttodo
- print "4 INFO Mode: %s" % e10s_mode
- print "5 INFO SimpleTest FINISHED"
+ print("0 INFO TEST-START | Shutdown")
+ print("1 INFO Passed: %s" % self.countpass)
+ print("2 INFO Failed: %s" % self.countfail)
+ print("3 INFO Todo: %s" % self.counttodo)
+ print("4 INFO Mode: %s" % e10s_mode)
+ print("5 INFO SimpleTest FINISHED")
return result
def doTests(self, options, testsToFilter=None):
# A call to initializeLooping method is required in case of --run-by-dir or --bisect-chunk
# since we need to initialize variables for each loop.
if options.bisectChunk or options.runByDir:
self.initializeLooping(options)