Bug 1428714 - [mozrunner] Add support for Python 3 r=ahal,davehunt

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
AndreiH 2019-02-20 14:00:15 +00:00
parent ef4b7f86ac
commit 24d18c114c
8 changed files with 27 additions and 20 deletions

View File

@ -87,6 +87,7 @@ class GeckoRuntimeRunner(BaseRunner):
class BlinkRuntimeRunner(BaseRunner):
"""A base runner class for running apps like Google Chrome or Chromium."""
def __init__(self, binary, cmdargs=None, **runner_args):
super(BlinkRuntimeRunner, self).__init__(**runner_args)
self.binary = binary

View File

@ -5,14 +5,16 @@
from __future__ import absolute_import
from abc import ABCMeta, abstractproperty
import os
import subprocess
import traceback
import sys
import traceback
from abc import ABCMeta, abstractproperty
from mozlog import get_default_logger
from mozprocess import ProcessHandler
from six import string_types
try:
import mozcrash
except ImportError:
@ -43,7 +45,7 @@ class BaseRunner(object):
dump_save_path=None, addons=None):
self.app_ctx = app_ctx or DefaultContext()
if isinstance(profile, basestring):
if isinstance(profile, string_types):
self.profile = self.app_ctx.profile_class(profile=profile,
addons=addons)
else:

View File

@ -8,7 +8,6 @@ import fileinput
import glob
import os
import platform
import psutil
import re
import shutil
import signal
@ -16,12 +15,13 @@ import subprocess
import sys
import telnetlib
import time
import urlparse
import urllib2
from distutils.spawn import find_executable
import psutil
import six.moves.urllib as urllib
from mozdevice import ADBHost, ADBDevice
from mozprocess import ProcessHandler
from six.moves.urllib.parse import urlparse
EMULATOR_HOME_DIR = os.path.join(os.path.expanduser('~'), '.mozbuild', 'android-device')
@ -431,7 +431,6 @@ def grant_runtime_permissions(build_obj, app, device_serial=None):
class AndroidEmulator(object):
"""
Support running the Android emulator with an AVD from Mozilla
test automation.
@ -547,6 +546,7 @@ class AndroidEmulator(object):
self.emulator_log.write("<%s>\n" % line)
if "Invalid value for -gpu" in line or "Invalid GPU mode" in line:
self.gpu = False
env = os.environ
env['ANDROID_AVD_HOME'] = os.path.join(EMULATOR_HOME_DIR, "avd")
command = [self.emulator_path, "-avd", self.avd_info.name]
@ -692,7 +692,7 @@ class AndroidEmulator(object):
def _verify_emulator(self):
telnet_ok = False
tn = None
while(not telnet_ok):
while (not telnet_ok):
try:
tn = telnetlib.Telnet('localhost', 5554, 10)
if tn is not None:
@ -827,7 +827,7 @@ def _log_info(text):
def _download_file(url, filename, path):
_log_debug("Download %s to %s/%s..." % (url, path, filename))
f = urllib2.urlopen(url)
f = urllib.urlopen(url)
if not os.path.isdir(path):
try:
os.makedirs(path)
@ -863,6 +863,7 @@ def _get_tooltool_manifest(substs, src_path, dst_path, filename):
def _tooltool_fetch():
def outputHandler(line):
_log_debug(line)
_download_file(TOOLTOOL_URL, 'tooltool.py', EMULATOR_HOME_DIR)
command = [sys.executable, 'tooltool.py',
'fetch', '-o', '-m', 'releng.manifest']

View File

@ -1,10 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# 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
from ConfigParser import (
ConfigParser,
RawConfigParser
)
import datetime
import os
import posixpath
@ -13,6 +12,7 @@ import tempfile
import time
from mozdevice import ADBHost, ADBError
from six.moves.configparser import ConfigParser, RawConfigParser
class Device(object):

View File

@ -8,17 +8,18 @@
from __future__ import absolute_import, print_function
import mozinfo
import os
import sys
__all__ = ['findInPath', 'get_metadata_from_egg']
import mozinfo
__all__ = ['findInPath', 'get_metadata_from_egg']
# python package method metadata by introspection
try:
import pkg_resources
def get_metadata_from_egg(module):
ret = {}
try:

View File

@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1

View File

@ -7,7 +7,7 @@ from __future__ import absolute_import
from setuptools import setup, find_packages
PACKAGE_NAME = 'mozrunner'
PACKAGE_VERSION = '7.3.0'
PACKAGE_VERSION = '7.4.0'
desc = """Reliable start/stop/configuration of Mozilla Applications (Firefox, Thunderbird, etc.)"""
@ -23,7 +23,6 @@ deps = [
EXTRAS_REQUIRE = {'crash': ['mozcrash >= 1.0']}
setup(name=PACKAGE_NAME,
version=PACKAGE_VERSION,
description=desc,
@ -33,7 +32,8 @@ setup(name=PACKAGE_NAME,
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords='mozilla',

View File

@ -2,7 +2,7 @@
subsuite = mozbase
# We skip these tests in automated Windows builds because they trigger crashes
# in sh.exe; see bug 1489277.
skip-if = python == 3 || (automation && os == "win")
skip-if = automation && os == "win"
[test_crash.py]
[test_interactive.py]
[test_start.py]