# HG changeset patch # User AndreiH # Date 1550830577 0 # Node ID faa0d674fe5f86219b9c2e0ee53a990adbdd9ff2 # Parent 72b09bbb9ac759b545420bbd28426f146dc0a306 Bug 1428714 - [mozrunner] Add support for Python 3 r=davehunt Differential Revision: https://phabricator.services.mozilla.com/D20486 diff --git a/testing/mozbase/mozrunner/mozrunner/base/browser.py b/testing/mozbase/mozrunner/mozrunner/base/browser.py --- a/testing/mozbase/mozrunner/mozrunner/base/browser.py +++ b/testing/mozbase/mozrunner/mozrunner/base/browser.py @@ -74,16 +74,17 @@ class GeckoRuntimeRunner(BaseRunner): self.env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" self.env["MOZ_CRASHREPORTER"] = "1" BaseRunner.start(self, *args, **kwargs) 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 self.cmdargs = cmdargs or [] data_dir, name = os.path.split(self.profile.profile) profile_args = [ '--user-data-dir={}'.format(data_dir), diff --git a/testing/mozbase/mozrunner/mozrunner/base/runner.py b/testing/mozbase/mozrunner/mozrunner/base/runner.py --- a/testing/mozbase/mozrunner/mozrunner/base/runner.py +++ b/testing/mozbase/mozrunner/mozrunner/base/runner.py @@ -1,23 +1,25 @@ #!/usr/bin/env python # 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 -from abc import ABCMeta, abstractproperty import os import subprocess +import sys import traceback -import sys +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: mozcrash = None from six import reraise from ..application import DefaultContext from ..errors import RunnerNotStartedError @@ -38,17 +40,17 @@ class BaseRunner(object): timeout = None output_timeout = None def __init__(self, app_ctx=None, profile=None, clean_profile=True, env=None, process_class=None, process_args=None, symbols_path=None, 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: self.profile = profile or self.app_ctx.profile_class(**getattr(self.app_ctx, 'profile_args', {})) self.logger = get_default_logger() diff --git a/testing/mozbase/mozrunner/mozrunner/utils.py b/testing/mozbase/mozrunner/mozrunner/utils.py --- a/testing/mozbase/mozrunner/mozrunner/utils.py +++ b/testing/mozbase/mozrunner/mozrunner/utils.py @@ -3,20 +3,21 @@ # 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/. """Utility functions for mozrunner""" from __future__ import absolute_import, print_function -import mozinfo import os import sys +import mozinfo + __all__ = ['findInPath', 'get_metadata_from_egg'] # python package method metadata by introspection try: import pkg_resources def get_metadata_from_egg(module): diff --git a/testing/mozbase/mozrunner/setup.cfg b/testing/mozbase/mozrunner/setup.cfg new file mode 100644 --- /dev/null +++ b/testing/mozbase/mozrunner/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/testing/mozbase/mozrunner/setup.py b/testing/mozbase/mozrunner/setup.py --- a/testing/mozbase/mozrunner/setup.py +++ b/testing/mozbase/mozrunner/setup.py @@ -2,43 +2,43 @@ # 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 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.)""" deps = [ 'mozdevice>=1.1.6', 'mozfile>=1.2', 'mozinfo>=0.7,<2', 'mozlog~=4.0', 'mozprocess>=0.23,<2', 'mozprofile~=2.1', 'six>=1.10.0,<2', ] EXTRAS_REQUIRE = {'crash': ['mozcrash >= 1.0']} - setup(name=PACKAGE_NAME, version=PACKAGE_VERSION, description=desc, long_description="see https://firefox-source-docs.mozilla.org/mozbase/index.html", classifiers=['Environment :: Console', 'Intended Audience :: Developers', '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', author='Mozilla Automation and Tools team', author_email='tools@lists.mozilla.org', url='https://wiki.mozilla.org/Auto-tools/Projects/Mozbase', license='MPL 2.0', packages=find_packages(), diff --git a/testing/mozbase/mozrunner/tests/manifest.ini b/testing/mozbase/mozrunner/tests/manifest.ini --- a/testing/mozbase/mozrunner/tests/manifest.ini +++ b/testing/mozbase/mozrunner/tests/manifest.ini @@ -1,10 +1,9 @@ [DEFAULT] subsuite = mozbase -skip-if = python == 3 [test_crash.py] [test_interactive.py] [test_start.py] [test_states.py] [test_stop.py] [test_threads.py] [test_wait.py] diff --git a/testing/mozbase/mozrunner/tests/manifest.ini.1428714.later b/testing/mozbase/mozrunner/tests/manifest.ini.1428714.later new file mode 100644 --- /dev/null +++ b/testing/mozbase/mozrunner/tests/manifest.ini.1428714.later @@ -0,0 +1,16 @@ +--- manifest.ini ++++ manifest.ini +@@ -1,12 +1,12 @@ + [DEFAULT] + 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] + [test_states.py] + [test_stop.py] + [test_threads.py] + [test_wait.py]