--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -1577,9 +1577,9 @@
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
}
}
-}
+}
\ No newline at end of file
--- a/testing/marionette/client/docs/conf.py
+++ b/testing/marionette/client/docs/conf.py
@@ -6,16 +6,18 @@
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
+from __future__ import absolute_import
+
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
--- a/testing/marionette/client/marionette_driver/__init__.py
+++ b/testing/marionette/client/marionette_driver/__init__.py
@@ -1,12 +1,14 @@
# 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
+
__version__ = '2.5.0'
from marionette_driver import (
addons,
by,
date_time_value,
decorators,
errors,
--- a/testing/marionette/client/marionette_driver/addons.py
+++ b/testing/marionette/client/marionette_driver/addons.py
@@ -1,12 +1,14 @@
# 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 . import errors
__all__ = ["Addons", "AddonInstallException"]
class AddonInstallException(errors.MarionetteException):
pass
--- a/testing/marionette/client/marionette_driver/by.py
+++ b/testing/marionette/client/marionette_driver/by.py
@@ -8,16 +8,18 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
+
class By(object):
ID = "id"
XPATH = "xpath"
LINK_TEXT = "link text"
PARTIAL_LINK_TEXT = "partial link text"
NAME = "name"
TAG_NAME = "tag name"
--- a/testing/marionette/client/marionette_driver/date_time_value.py
+++ b/testing/marionette/client/marionette_driver/date_time_value.py
@@ -1,12 +1,14 @@
# 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
+
class DateTimeValue(object):
"""
Interface for setting the value of HTML5 "date" and "time" input elements.
Simple usage example:
::
--- a/testing/marionette/client/marionette_driver/decorators.py
+++ b/testing/marionette/client/marionette_driver/decorators.py
@@ -1,12 +1,17 @@
# 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 functools import wraps
import socket
def _find_marionette_in_args(*args, **kwargs):
try:
m = [a for a in args + tuple(kwargs.values()) if hasattr(a, 'session')][0]
except IndexError:
--- a/testing/marionette/client/marionette_driver/errors.py
+++ b/testing/marionette/client/marionette_driver/errors.py
@@ -1,12 +1,14 @@
# 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
+
import traceback
class MarionetteException(Exception):
"""Raised when a generic non-recoverable exception has occured."""
status = "webdriver error"
--- a/testing/marionette/client/marionette_driver/expected.py
+++ b/testing/marionette/client/marionette_driver/expected.py
@@ -1,16 +1,18 @@
# 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/.
-import errors
+from __future__ import absolute_import
+
import types
+from . import errors
-from marionette import HTMLElement
+from .marionette import HTMLElement
"""This file provides a set of expected conditions for common use
cases when writing Marionette tests.
The conditions rely on explicit waits that retries conditions a number
of times until they are either successfully met, or they time out.
"""
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -1,12 +1,14 @@
# 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
+
import os
import sys
import tempfile
import time
from copy import deepcopy
import mozversion
@@ -204,17 +206,17 @@ class GeckoInstance(object):
if not app and kwargs["bin"] is not None:
app_id = mozversion.get_version(binary=kwargs["bin"])["application_id"]
app = app_ids[app_id]
instance_class = apps[app]
except (IOError, KeyError):
exc, val, tb = sys.exc_info()
msg = 'Application "{0}" unknown (should be one of {1})'
- raise NotImplementedError, msg.format(app, apps.keys()), tb
+ raise NotImplementedError(msg.format(app, apps.keys()), tb)
return instance_class(*args, **kwargs)
def start(self):
self._update_profile()
self.runner = self.runner_class(**self._get_runner_args())
self.runner.start()
@@ -347,17 +349,17 @@ class FennecInstance(GeckoInstance):
self.runner = self.runner_class(**self._get_runner_args())
try:
if self.connect_to_running_emulator:
self.runner.device.connect()
self.runner.start()
except Exception as e:
exc, val, tb = sys.exc_info()
message = "Error possibly due to runner or device args: {}"
- raise exc, message.format(e.message), tb
+ raise exc(message.format(e.message), tb)
# gecko_log comes from logcat when running with device/emulator
logcat_args = {
"filterspec": "Gecko",
"serial": self.runner.device.dm._deviceSerial
}
if self.gecko_log == "-":
logcat_args["stream"] = sys.stdout
else:
--- a/testing/marionette/client/marionette_driver/gestures.py
+++ b/testing/marionette/client/marionette_driver/gestures.py
@@ -1,13 +1,15 @@
# 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 marionette import MultiActions, Actions
+from __future__ import absolute_import
+
+from .marionette import MultiActions, Actions
def smooth_scroll(marionette_session, start_element, axis, direction,
length, increments=None, wait_period=None, scroll_back=None):
"""
:param axis: y or x
:param direction: 0 for positive, and -1 for negative
:param length: total length of scroll scroll
--- a/testing/marionette/client/marionette_driver/keys.py
+++ b/testing/marionette/client/marionette_driver/keys.py
@@ -8,16 +8,18 @@
# http //www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
+
class Keys(object):
NULL = u'\ue000'
CANCEL = u'\ue001' # ^break
HELP = u'\ue002'
BACK_SPACE = u'\ue003'
TAB = u'\ue004'
--- a/testing/marionette/client/marionette_driver/localization.py
+++ b/testing/marionette/client/marionette_driver/localization.py
@@ -1,12 +1,14 @@
# 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
+
class L10n(object):
"""An API which allows Marionette to handle localized content.
The `localization`_ of UI elements in Gecko based applications is done via
entities and properties. For static values entities are used, which are located
in .dtd files. Whereby for dynamically updated content the values come from
.property files. Both types of elements can be identifed via a unique id,
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1,26 +1,28 @@
# 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
+
import base64
import datetime
import json
import os
import socket
import sys
import time
import traceback
import warnings
from contextlib import contextmanager
-import errors
-import transport
+from . import errors
+from . import transport
from .decorators import do_process_check
from .geckoinstance import GeckoInstance
from .keys import Keys
from .timeout import Timeouts
WEBELEMENT_KEY = "ELEMENT"
W3C_WEBELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf"
@@ -634,17 +636,17 @@ class Marionette(object):
except socket.timeout:
# Something went wrong with starting up Marionette server. Given
# that the process will not quit itself, force a shutdown immediately.
self.cleanup()
msg = "Process killed after {}s because no connection to Marionette "\
"server could be established. Check gecko.log for errors"
_, _, tb = sys.exc_info()
- raise IOError, msg.format(timeout), tb
+ raise IOError(msg.format(timeout), tb)
def cleanup(self):
if self.session is not None:
try:
self.delete_session()
except (errors.MarionetteException, IOError):
# These exceptions get thrown if the Marionette server
# hit an exception/died or the connection died. We can
@@ -788,17 +790,17 @@ class Marionette(object):
frame, and is only called via the `@do_process_check` decorator.
"""
exc, val, tb = sys.exc_info()
# If the application hasn't been launched by Marionette no further action can be done.
# In such cases we simply re-throw the exception.
if not self.instance:
- raise exc, val, tb
+ raise exc(val, tb)
else:
# Somehow the socket disconnected. Give the application some time to shutdown
# itself before killing the process.
returncode = self.instance.runner.wait(timeout=self.DEFAULT_SHUTDOWN_TIMEOUT)
if returncode is None:
message = ('Process killed because the connection to Marionette server is '
@@ -816,17 +818,17 @@ class Marionette(object):
message = 'Process crashed (Exit code: {returncode})'
else:
message = 'Process has been unexpectedly closed (Exit code: {returncode})'
self.delete_session(send_request=False, reset_session_id=True)
message += ' (Reason: {reason})'
- raise IOError, message.format(returncode=returncode, reason=val), tb
+ raise IOError(message.format(returncode=returncode, reason=val), tb)
@staticmethod
def convert_keys(*string):
typing = []
for val in string:
if isinstance(val, Keys):
typing.append(val)
elif isinstance(val, int):
@@ -1146,17 +1148,17 @@ class Marionette(object):
try:
timeout = self.DEFAULT_SHUTDOWN_TIMEOUT + self.DEFAULT_STARTUP_TIMEOUT
self.raise_for_port(timeout=timeout)
except socket.timeout:
if self.instance.runner.returncode is not None:
exc, val, tb = sys.exc_info()
self.cleanup()
- raise exc, "Requested restart of the application was aborted", tb
+ raise exc("Requested restart of the application was aborted", tb)
else:
self.delete_session()
self.instance.restart(clean=clean)
self.raise_for_port(timeout=self.DEFAULT_STARTUP_TIMEOUT)
if cause not in (None, "restart"):
raise errors.MarionetteException("Unexpected shutdown reason '{}' for "
--- a/testing/marionette/client/marionette_driver/selection.py
+++ b/testing/marionette/client/marionette_driver/selection.py
@@ -1,13 +1,15 @@
# -*- coding: utf-8 -*-
# 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
+
class SelectionManager(object):
'''Interface for manipulating the selection and carets of the element.
We call the blinking cursor (nsCaret) as cursor, and call AccessibleCaret as
caret for short.
Simple usage example:
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -1,14 +1,16 @@
# 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/.
-import errors
+from __future__ import absolute_import
+
+from . import errors
DEFAULT_SCRIPT_TIMEOUT = 30
DEFAULT_PAGE_LOAD_TIMEOUT = 300
DEFAULT_IMPLICIT_WAIT_TIMEOUT = 0
class Timeouts(object):
--- a/testing/marionette/client/marionette_driver/transport.py
+++ b/testing/marionette/client/marionette_driver/transport.py
@@ -1,12 +1,14 @@
# 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
+
import json
import socket
import sys
import time
class SocketTimeout(object):
def __init__(self, socket, timeout):
@@ -199,17 +201,17 @@ class TcpTransport(object):
with SocketTimeout(self._sock, 60.0):
# first packet is always a JSON Object
# which we can use to tell which protocol level we are at
raw = self.receive(unmarshal=False)
except socket.timeout:
msg = "Connection attempt failed because no data has been received over the socket: {}"
exc, val, tb = sys.exc_info()
- raise exc, msg.format(val), tb
+ raise exc(msg.format(val), tb)
hello = json.loads(raw)
application_type = hello.get("applicationType")
protocol = hello.get("marionetteProtocol")
if application_type != "gecko":
raise ValueError("Application type '{}' is not supported".format(application_type))
--- a/testing/marionette/client/marionette_driver/wait.py
+++ b/testing/marionette/client/marionette_driver/wait.py
@@ -1,14 +1,16 @@
# 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
+
import collections
-import errors
+from . import errors
import sys
import time
DEFAULT_TIMEOUT = 5
DEFAULT_INTERVAL = 0.1
class Wait(object):
--- a/testing/marionette/client/setup.py
+++ b/testing/marionette/client/setup.py
@@ -1,12 +1,14 @@
# 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
+
import os
import re
from setuptools import setup, find_packages
THIS_DIR = os.path.dirname(os.path.realpath(__name__))
def read(*parts):
--- a/testing/marionette/harness/marionette_harness/__init__.py
+++ b/testing/marionette/harness/marionette_harness/__init__.py
@@ -1,12 +1,14 @@
# 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
+
__version__ = '4.3.0'
from .marionette_test import (
CommonTestCase,
expectedFailure,
MarionetteTestCase,
parameterized,
run_if_e10s,
--- a/testing/marionette/harness/marionette_harness/marionette_test/__init__.py
+++ b/testing/marionette/harness/marionette_harness/marionette_test/__init__.py
@@ -1,15 +1,16 @@
# 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
+
__version__ = '3.1.0'
-
from unittest.case import (
expectedFailure,
skip,
SkipTest,
)
from .decorators import (
parameterized,
--- a/testing/marionette/harness/marionette_harness/marionette_test/decorators.py
+++ b/testing/marionette/harness/marionette_harness/marionette_test/decorators.py
@@ -1,12 +1,14 @@
# 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
+
import functools
import types
from unittest.case import (
SkipTest,
)
--- a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
+++ b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
@@ -1,12 +1,14 @@
# 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
+
import imp
import re
import sys
import time
import types
import unittest
import warnings
import weakref
--- a/testing/marionette/harness/marionette_harness/runner/__init__.py
+++ b/testing/marionette/harness/marionette_harness/runner/__init__.py
@@ -1,12 +1,14 @@
# 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 .base import (
BaseMarionetteArguments,
BaseMarionetteTestRunner,
Marionette,
MarionetteTest,
MarionetteTestResult,
MarionetteTextTestRunner,
TestManifest,
--- a/testing/marionette/harness/marionette_harness/runner/base.py
+++ b/testing/marionette/harness/marionette_harness/runner/base.py
@@ -1,12 +1,14 @@
# 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
+
import json
import os
import random
import re
import socket
import sys
import time
import traceback
@@ -15,24 +17,24 @@ import unittest
from argparse import ArgumentParser
from collections import defaultdict
from copy import deepcopy
import mozinfo
import moznetwork
import mozprofile
import mozversion
-import serve
+from . import serve
from manifestparser import TestManifest
from manifestparser.filters import tags
from marionette_driver.marionette import Marionette
from moztest.adapters.unit import StructuredTestResult, StructuredTestRunner
from moztest.results import TestResult, TestResultCollection, relevant_line
-from serve import iter_proc, iter_url
+from .serve import iter_proc, iter_url
here = os.path.abspath(os.path.dirname(__file__))
def update_mozinfo(path=None):
"""Walk up directories to find mozinfo.json and update the info."""
path = path or here
dirs = set()
@@ -651,17 +653,17 @@ class BaseMarionetteTestRunner(object):
if not os.path.exists(path):
raise IOError('--testvars file {} does not exist'.format(path))
try:
with open(path) as f:
data.append(json.loads(f.read()))
except ValueError as e:
exc, val, tb = sys.exc_info()
msg = "JSON file ({0}) is not properly formatted: {1}"
- raise exc, msg.format(os.path.abspath(path), e.message), tb
+ raise exc(msg.format(os.path.abspath(path), e.message), tb)
return data
@property
def capabilities(self):
if self._capabilities:
return self._capabilities
self.marionette.start_session()
@@ -762,17 +764,17 @@ class BaseMarionetteTestRunner(object):
try:
# Establish a socket connection so we can vertify the data come back
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection.connect((host, int(port)))
connection.close()
except Exception as e:
exc, val, tb = sys.exc_info()
msg = "Connection attempt to {0}:{1} failed with error: {2}"
- raise exc, msg.format(host, port, e), tb
+ raise exc(msg.format(host, port, e), tb)
if self.workspace:
kwargs['workspace'] = self.workspace_path
if self.headless:
kwargs['headless'] = True
return kwargs
def record_crash(self):
@@ -912,17 +914,17 @@ class BaseMarionetteTestRunner(object):
# raise only the exception if we were not interrupted
if not interrupted:
raise
finally:
self.cleanup()
# reraise previous interruption now
if interrupted:
- raise interrupted[0], interrupted[1], interrupted[2]
+ raise interrupted[0](interrupted[1], interrupted[2])
def _print_summary(self, tests):
self.logger.info('\nSUMMARY\n-------')
self.logger.info('passed: {}'.format(self.passed))
if self.unexpected_successes == 0:
self.logger.info('failed: {}'.format(self.failed))
else:
self.logger.info(
--- a/testing/marionette/harness/marionette_harness/runner/httpd.py
+++ b/testing/marionette/harness/marionette_harness/runner/httpd.py
@@ -3,16 +3,20 @@
# 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/.
"""Specialisation of wptserver.server.WebTestHttpd for testing
Marionette.
"""
+from __future__ import (
+ absolute_import,
+ print_function
+)
import argparse
import os
import select
import sys
import time
import urlparse
@@ -170,11 +174,13 @@ e.g. \"https://0.0.0.0:0/base/\"""")
"-k", dest="ssl_key", default=default_ssl_key,
help="path to SSL certificate key (default %(default)s)")
args = parser.parse_args()
httpd = FixtureServer(args.doc_root, args.url,
ssl_cert=args.ssl_cert,
ssl_key=args.ssl_key)
httpd.start()
- print >>sys.stderr, "%s: started fixture server on %s" % \
- (sys.argv[0], httpd.get_url("/"))
+ print(
+ sys.stderr,
+ "%s: started fixture server on %s" % (sys.argv[0], httpd.get_url("/"))
+ )
httpd.wait()
--- a/testing/marionette/harness/marionette_harness/runner/mixins/__init__.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/__init__.py
@@ -1,12 +1,14 @@
# 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 .browsermob import (
BrowserMobProxyTestCaseMixin,
BrowserMobProxyArguments,
BrowserMobTestCase,
)
from .window_manager import (
WindowManagerMixin,
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/__init__.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/__init__.py
@@ -1,6 +1,8 @@
+from __future__ import absolute_import
+
__version__ = '0.5.0'
from .server import Server
from .client import Client
__all__ = ['Server', 'Client', 'browsermobproxy']
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/client.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/client.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
import requests
try:
from urllib.parse import urlencode, unquote
except ImportError:
from urllib import urlencode, unquote
import json
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/server.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/server.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
import os
import platform
import socket
import subprocess
import time
from .client import Client
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/webdriver_event_listener.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/webdriver_event_listener.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
from selenium.webdriver.support.abstract_event_listener import AbstractEventListener
class WebDriverEventListener(AbstractEventListener):
def __init__(self, client, refs={}):
self.client = client
self.hars = []
self.refs = refs
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/docs/conf.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/docs/conf.py
@@ -6,16 +6,18 @@
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
+from __future__ import absolute_import
+
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../'))
# -- General configuration -----------------------------------------------------
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/setup.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/setup.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
from setuptools import setup, find_packages
setup(name='browsermob-proxy',
version='0.6.0',
description='A library for interacting with the Browsermob Proxy',
author='David Burns',
author_email='david.burns at theautomatedtester dot co dot uk',
url='http://oss.theautomatedtester.co.uk/browsermob-proxy-py',
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/test/test_client.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/test/test_client.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
import os.path
import pytest
import sys
def setup_module(module):
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/test/test_remote.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/test/test_remote.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
from selenium import webdriver
import selenium.webdriver.common.desired_capabilities
import os
import sys
import time
import pytest
def setup_module(module):
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/test/test_webdriver.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/test/test_webdriver.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
from selenium import webdriver
import selenium.webdriver.common.desired_capabilities
from selenium.webdriver.common.proxy import Proxy
import os
import sys
import copy
import time
import pytest
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob.py
@@ -1,12 +1,14 @@
# 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
+
import os
from browsermobproxy import Server
from marionette_harness import MarionetteTestCase
class BrowserMobProxyArguments(object):
name = 'Browsermob Proxy'
--- a/testing/marionette/harness/marionette_harness/runner/mixins/window_manager.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/window_manager.py
@@ -1,12 +1,14 @@
# 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
+
import sys
from marionette_driver import By, Wait
class WindowManagerMixin(object):
_menu_item_new_tab = (By.ID, "menu_newNavigatorTab")
@@ -63,17 +65,17 @@ class WindowManagerMixin(object):
try:
if callable(trigger):
trigger()
elif trigger == 'menu':
with self.marionette.using_context("chrome"):
self.marionette.find_element(*self._menu_item_new_tab).click()
except Exception:
exc, val, tb = sys.exc_info()
- raise exc, 'Failed to trigger opening a new tab: {}'.format(val), tb
+ raise exc('Failed to trigger opening a new tab: {}'.format(val), tb)
else:
Wait(self.marionette).until(
lambda mn: len(mn.window_handles) == len(current_tabs) + 1,
message="No new tab has been opened"
)
[new_tab] = list(set(self.marionette.window_handles) - set(current_tabs))
@@ -94,17 +96,17 @@ class WindowManagerMixin(object):
try:
if callable(trigger):
trigger()
else:
with self.marionette.using_context("chrome"):
self.marionette.execute_script("window.open();")
except Exception:
exc, val, tb = sys.exc_info()
- raise exc, 'Failed to trigger opening a new window: {}'.format(val), tb
+ raise exc('Failed to trigger opening a new window: {}'.format(val), tb)
else:
Wait(self.marionette).until(
lambda mn: len(mn.chrome_window_handles) == len(current_windows) + 1,
message="No new window has been opened"
)
[new_window] = list(set(self.marionette.chrome_window_handles) - set(current_windows))
--- a/testing/marionette/harness/marionette_harness/runner/serve.py
+++ b/testing/marionette/harness/marionette_harness/runner/serve.py
@@ -4,24 +4,29 @@
# 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/.
"""Spawns necessary HTTP servers for testing Marionette in child
processes.
"""
+from __future__ import (
+ absolute_import,
+ print_function
+)
+
import argparse
import multiprocessing
import os
import sys
from collections import defaultdict
-import httpd
+from . import httpd
__all__ = ["default_doc_root",
"iter_proc",
"iter_url",
"registered_servers",
"servers",
"start",
@@ -207,17 +212,17 @@ def main(args):
parser = argparse.ArgumentParser()
parser.add_argument("-r", dest="doc_root",
help="Path to document root. Overrides default.")
args = parser.parse_args()
servers = start(args.doc_root)
for url in iter_url(servers):
- print >>sys.stderr, "{}: listening on {}".format(sys.argv[0], url)
+ print(sys.stderr, "{}: listening on {}".format(sys.argv[0], url))
try:
while any(proc.is_alive for proc in iter_proc(servers)):
for proc in iter_proc(servers):
proc.proc.join(1)
except KeyboardInterrupt:
for proc in iter_proc(servers):
proc.kill()
--- a/testing/marionette/harness/marionette_harness/runtests.py
+++ b/testing/marionette/harness/marionette_harness/runtests.py
@@ -1,12 +1,14 @@
# 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
+
import sys
import mozlog
from marionette_driver import __version__ as driver_version
from marionette_harness import (
__version__,
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
@@ -1,12 +1,14 @@
# 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
+
import pytest
from mock import Mock, MagicMock
from marionette_driver.marionette import Marionette
from marionette_harness.runner.httpd import FixtureServer
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_httpd.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_httpd.py
@@ -1,12 +1,14 @@
# 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
+
import json
import os
import types
import urllib2
import mozunit
import pytest
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_arguments.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_arguments.py
@@ -1,11 +1,14 @@
# 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
+
import mozunit
import pytest
from marionette_harness.runtests import MarionetteArguments
@pytest.mark.parametrize("socket_timeout", ['A', '10', '1B-', '1C2', '44.35'])
def test_parse_arg_socket_timeout(socket_timeout):
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_harness.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_harness.py
@@ -1,12 +1,14 @@
# 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
+
import mozunit
import pytest
from mock import Mock, patch, sentinel
import marionette_harness.marionette_test as marionette_test
from marionette_harness.runtests import MarionetteTestRunner, MarionetteHarness, cli
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
@@ -1,12 +1,14 @@
# 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
+
import manifestparser
import mozunit
import pytest
from mock import Mock, patch, mock_open, sentinel, DEFAULT
from marionette_harness.runtests import MarionetteTestRunner
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_test_result.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_test_result.py
@@ -1,12 +1,14 @@
# 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
+
import mozunit
import pytest
from marionette_harness import MarionetteTestResult
@pytest.fixture
def empty_marionette_testcase():
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_serve.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_serve.py
@@ -1,12 +1,14 @@
# 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
+
import types
import mozunit
import pytest
from marionette_harness.runner import serve
from marionette_harness.runner.serve import iter_proc, iter_url
--- a/testing/marionette/harness/marionette_harness/tests/unit/single_finger_functions.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/single_finger_functions.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
from marionette_driver.marionette import Actions
from marionette_driver.errors import TimeoutException
from marionette_driver.by import By
def wait_for_condition_else_raise(marionette, wait_for_condition, expected, script):
try:
wait_for_condition(lambda m: expected in m.execute_script(script))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_accessibility.py
@@ -1,12 +1,14 @@
# 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
+
import sys
import unittest
from marionette_driver.by import By
from marionette_driver.errors import (
ElementNotAccessibleException,
ElementNotInteractableException,
ElementClickInterceptedException,
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py
@@ -1,12 +1,14 @@
# 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
+
import os
from marionette_driver.addons import Addons, AddonInstallException
from marionette_harness import MarionetteTestCase
here = os.path.abspath(os.path.dirname(__file__))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_anonymous_content.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_anonymous_content.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException
from marionette_driver.marionette import HTMLElement
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestAnonymousNodes(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_browsermobproxy.py
@@ -1,10 +1,12 @@
import datetime
+from __future__ import absolute_import
+
from marionette_harness.runner import BrowserMobTestCase
class TestBrowserMobProxy(BrowserMobTestCase):
"""To run this test, you'll need to download the browsermob-proxy from
http://bmp.lightbody.net/, and then pass the path to the startup
script (typically /path/to/browsermob-proxy-2.0.0/bin/browsermob-proxy)
as the --browsermob-script argument when running runtests.py.
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
@@ -1,12 +1,17 @@
# 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 marionette_driver.errors import SessionNotCreatedException
from marionette_harness import MarionetteTestCase
# Unlike python 3, python 2 doesn't have a proper implementation of realpath or
# samefile for Windows. However this function, which does exactly what we want,
# was added to python 2 to fix an issue with tcl installations and symlinks.
from FixTk import convert_path
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_checkbox.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_checkbox.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestCheckbox(MarionetteTestCase):
def test_selected(self):
test_html = self.marionette.absolute_url("test.html")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_checkbox_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_checkbox_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestSelectedChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_chrome.py
@@ -8,16 +8,18 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
+from __future__ import absolute_import
+
from marionette_driver import By
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class ChromeTests(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_chrome_element_css.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_chrome_element_css.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestChromeElementCSS(MarionetteTestCase):
def get_element_computed_style(self, element, property):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_clearing.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_clearing.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import InvalidElementStateException
from marionette_harness import MarionetteTestCase
class TestClear(MarionetteTestCase):
def testWriteableTextInputShouldClear(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_cli_arguments.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_cli_arguments.py
@@ -1,12 +1,14 @@
# 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
+
import copy
from marionette_harness import MarionetteTestCase
class TestCommandLineArguments(MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver import By, errors
from marionette_harness import (
MarionetteTestCase,
run_if_e10s,
skip_if_mobile,
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_click_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestClickChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_click_scrolling.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click_scrolling.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import MoveTargetOutOfBoundsException
from marionette_harness import MarionetteTestCase, skip, skip_if_mobile
class TestClickScrolling(MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_cookies.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_cookies.py
@@ -1,12 +1,17 @@
# 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
+)
+
import calendar
import random
import time
from marionette_driver.errors import UnsupportedOperationException
from marionette_harness import MarionetteTestCase
@@ -46,17 +51,17 @@ class CookieTest(MarionetteTestCase):
self.assertRaises(UnsupportedOperationException,
self.marionette.delete_all_cookies)
self.assertRaises(UnsupportedOperationException,
self.marionette.get_cookies)
def test_delete_all_cookie(self):
self.marionette.add_cookie(self.COOKIE_A)
cookie_returned = str(self.marionette.execute_script("return document.cookie"))
- print cookie_returned
+ print(cookie_returned)
self.assertTrue(self.COOKIE_A["name"] in cookie_returned)
self.marionette.delete_all_cookies()
self.assertFalse(self.marionette.get_cookies())
def test_delete_cookie(self):
self.marionette.add_cookie(self.COOKIE_A)
cookie_returned = str(self.marionette.execute_script("return document.cookie"))
self.assertTrue(self.COOKIE_A["name"] in cookie_returned)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
@@ -1,12 +1,14 @@
# 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
+
import glob
import shutil
from marionette_driver import Wait
from marionette_driver.errors import (
MarionetteException,
NoSuchWindowException,
TimeoutException
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_data_driven.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_data_driven.py
@@ -1,12 +1,14 @@
# 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 marionette_harness.marionette_test import (
parameterized,
with_parameters,
MetaParameterized,
MarionetteTestCase
)
class Parameterizable(object):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_date_time_value.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_date_time_value.py
@@ -1,12 +1,14 @@
# 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 datetime import datetime
from marionette_driver.by import By
from marionette_driver.date_time_value import DateTimeValue
from marionette_harness import MarionetteTestCase
class TestDateTime(MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_element_retrieval.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_element_retrieval.py
@@ -1,12 +1,14 @@
# 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
+
import re
import urllib
from marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException, InvalidSelectorException
from marionette_driver.marionette import HTMLElement
from marionette_harness import MarionetteTestCase, skip
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_element_state.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_element_state.py
@@ -1,12 +1,17 @@
# 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
+)
+
import types
import urllib
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_element_state_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_element_state_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase, skip, WindowManagerMixin
class TestElementState(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_elementsize.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_elementsize.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestElementSize(MarionetteTestCase):
def testShouldReturnTheSizeOfALink(self):
test_html = self.marionette.absolute_url("testSize.html")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_elementsize_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_elementsize_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestElementSizeChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_errors.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_errors.py
@@ -1,12 +1,14 @@
# 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
+
import sys
from marionette_driver import errors
from marionette_harness import marionette_test
def fake_cause():
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_async_script.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_async_script.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
from marionette_driver.errors import (
JavascriptException,
ScriptTimeoutException,
)
from marionette_harness import MarionetteTestCase
@@ -55,17 +57,17 @@ class TestExecuteAsyncContent(Marionette
def test_execute_js_exception(self):
try:
self.marionette.execute_async_script("""
let a = 1;
foo(bar);
""")
self.assertFalse(True)
- except JavascriptException, inst:
+ except JavascriptException as inst:
self.assertTrue('foo(bar)' in inst.stacktrace)
def test_execute_async_js_exception(self):
self.assertRaises(JavascriptException,
self.marionette.execute_async_script, """
var callback = arguments[arguments.length - 1];
callback(foo());
""")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_isolate.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import ScriptTimeoutException
from marionette_harness import MarionetteTestCase
class TestExecuteIsolationContent(MarionetteTestCase):
def setUp(self):
super(TestExecuteIsolationContent, self).setUp()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_sandboxes.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_sandboxes.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import JavascriptException
from marionette_harness import MarionetteTestCase
class TestExecuteSandboxes(MarionetteTestCase):
def setUp(self):
super(TestExecuteSandboxes, self).setUp()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
import os
import urllib
from marionette_driver import By, errors
from marionette_driver.marionette import Alert, HTMLElement
from marionette_driver.wait import Wait
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_expected.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_expected.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver import expected
from marionette_driver.by import By
from marionette_harness import marionette_test
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_expectedfail.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_expectedfail.py
@@ -1,11 +1,13 @@
# 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 marionette_harness import MarionetteTestCase
class TestFail(MarionetteTestCase):
def test_fails(self):
# this test is supposed to fail!
self.assertEquals(True, False)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_file_upload.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_file_upload.py
@@ -1,12 +1,14 @@
# 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
+
import contextlib
import urllib
from tempfile import NamedTemporaryFile as tempfile
from marionette_driver import By, errors, expected
from marionette_driver.wait import Wait
from marionette_harness import MarionetteTestCase, skip
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_findelement_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_findelement_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException
from marionette_driver.marionette import HTMLElement
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestElementsChrome(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_geckoinstance.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_geckoinstance.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.geckoinstance import apps, GeckoInstance
from marionette_harness import MarionetteTestCase
class TestGeckoInstance(MarionetteTestCase):
def test_create(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_get_current_url_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_get_current_url_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import NoSuchWindowException
from marionette_harness import MarionetteTestCase, WindowManagerMixin, skip_if_mobile
class TestGetCurrentUrlChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_getactiveframe_oop.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_getactiveframe_oop.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
OOP_BY_DEFAULT = "dom.ipc.browser_frames.oop_by_default"
BROWSER_FRAMES_ENABLED = "dom.mozBrowserFramesEnabeld"
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_implicit_waits.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_implicit_waits.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException
from marionette_harness import MarionetteTestCase
class TestImplicitWaits(MarionetteTestCase):
def test_implicitly_wait_for_single_element(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver.by import By
from marionette_driver.keys import Keys
from marionette_driver.marionette import Actions
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_localization.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_localization.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from marionette_driver.errors import (
InvalidArgumentException,
NoSuchElementException,
UnknownException
)
from marionette_driver.localization import L10n
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_marionette.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_marionette.py
@@ -1,12 +1,14 @@
# 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
+
import socket
import time
from marionette_driver import errors
from marionette_driver.marionette import Marionette
from marionette_harness import MarionetteTestCase, run_if_manage_instance, skip_if_mobile
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_modal_dialogs.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_modal_dialogs.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.expected import element_present
from marionette_driver import errors
from marionette_driver.marionette import Alert
from marionette_driver.wait import Wait
from marionette_harness import MarionetteTestCase, WindowManagerMixin
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver.by import By
from marionette_driver.keys import Keys
from marionette_driver.marionette import Actions
from marionette_harness import MarionetteTestCase
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -1,12 +1,17 @@
# 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
+)
+
import contextlib
import os
import urllib
from marionette_driver import By, errors, expected, Wait
from marionette_driver.keys import Keys
from marionette_harness import (
MarionetteTestCase,
@@ -700,26 +705,26 @@ class TestTLSNavigation(MarionetteTestCa
self.marionette.navigate(
inline("<a href=%s>https is the future</a>" % link_url))
self.marionette.find_element(By.TAG_NAME, "a").click()
self.assertIn("https", self.marionette.get_url())
def test_deactivation(self):
invalid_cert_url = self.test_page_insecure
- print "with safe session"
+ print("with safe session")
with self.safe_session() as session:
with self.assertRaises(errors.InsecureCertificateException):
session.navigate(invalid_cert_url)
- print "with unsafe session"
+ print("with unsafe session")
with self.unsafe_session() as session:
session.navigate(invalid_cert_url)
- print "with safe session again"
+ print("with safe session again")
with self.safe_session() as session:
with self.assertRaises(errors.InsecureCertificateException):
session.navigate(invalid_cert_url)
class TestPageLoadStrategy(BaseNavigationTestCase):
def tearDown(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase
class TestPageSource(MarionetteTestCase):
def testShouldReturnTheSourceOfAPage(self):
test_html = self.marionette.absolute_url("testPageSource.html")
self.marionette.navigate(test_html)
source = self.marionette.page_source
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestPageSourceChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestPageSourceChrome, self).setUp()
self.marionette.set_context("chrome")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_position.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_position.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestPosition(MarionetteTestCase):
def test_should_get_element_position_back(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import JavascriptException
from marionette_harness import MarionetteTestCase
class TestPreferences(MarionetteTestCase):
prefs = {
"bool": "marionette.test.bool",
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase
class TestProfileManagement(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.enforce_gecko_prefs(
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_proxy.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_proxy.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import errors
from marionette_harness import MarionetteTestCase
class TestProxyCapabilities(MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_quit_restart.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_quit_restart.py
@@ -1,12 +1,17 @@
# 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
+)
+
import unittest
from marionette_driver import errors
from marionette_harness import MarionetteTestCase, skip
class TestServerQuitApplication(MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_rendered_element.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_rendered_element.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
import urllib
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase
def inline(doc):
return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_report.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_report.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, expectedFailure, skip
class TestReport(MarionetteTestCase):
def test_pass(self):
assert True
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_run_js_test.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_run_js_test.py
@@ -1,10 +1,12 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
+from __future__ import absolute_import
+
from marionette_harness import MarionetteTestCase
class TestRunJSTest(MarionetteTestCase):
def test_basic(self):
self.run_js_test('test_simpletest_pass.js')
self.run_js_test('test_simpletest_fail.js')
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_screen_orientation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_screen_orientation.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import errors
from mozrunner.devices.emulator_screen import EmulatorScreen
from marionette_harness import MarionetteTestCase, skip_if_desktop, skip_if_mobile
default_orientation = "portrait-primary"
unknown_orientation = "Unknown screen orientation: {}"
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_screenshot.py
@@ -1,12 +1,14 @@
# 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
+
import base64
import hashlib
import imghdr
import struct
import urllib
from marionette_driver import By
from marionette_driver.errors import NoSuchElementException, NoSuchWindowException
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_select.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_select.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase
def inline(doc):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_session.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_session.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import errors
from marionette_harness import MarionetteTestCase
class TestSession(MarionetteTestCase):
def setUp(self):
super(TestSession, self).setUp()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_shadow_dom.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_shadow_dom.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import (
NoSuchElementException,
StaleElementException,
UnsupportedOperationException,
)
from marionette_harness import MarionetteTestCase
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_single_finger_desktop.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_single_finger_desktop.py
@@ -1,12 +1,14 @@
# 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
+
import os
import sys
from marionette_driver.errors import MarionetteException
from marionette_driver import Actions, By
from marionette_harness import MarionetteTestCase, skip
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_skip_setup.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_skip_setup.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, SkipTest
class TestSetUpSkipped(MarionetteTestCase):
testVar = {'test':'SkipTest'}
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_switch_frame.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_switch_frame.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import (
JavascriptException,
NoSuchFrameException,
)
from marionette_harness import MarionetteTestCase
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_switch_frame_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_switch_frame_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import JavascriptException
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestSwitchFrameChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_switch_window_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_switch_window_chrome.py
@@ -1,12 +1,14 @@
# 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
+
import os
import sys
from unittest import skipIf
from marionette_driver import By
# add this directory to the path
sys.path.append(os.path.dirname(__file__))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_switch_window_content.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_switch_window_content.py
@@ -1,12 +1,14 @@
# This Source Code Form is subject to the terms of the Mozilla ublic
# 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 marionette_driver import Actions, By, Wait
from marionette_driver.keys import Keys
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
class TestSwitchToWindowContent(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_teardown_context_preserved.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_teardown_context_preserved.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, SkipTest
class TestTearDownContext(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.set_context(self.marionette.CONTEXT_CHROME)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_text.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_text.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestText(MarionetteTestCase):
def test_get_text(self):
test_html = self.marionette.absolute_url("test.html")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_text_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase, skip, WindowManagerMixin
@skip("Disabled in bug 896043 and when working on Chrome code re-enable for bug 896046")
class TestTextChrome(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_driver.errors import (
MarionetteException,
NoSuchElementException,
ScriptTimeoutException,
)
from marionette_driver.marionette import HTMLElement
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_title.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_title.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase, skip
def inline(doc):
return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_title_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_title_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestTitleChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestTitleChrome, self).setUp()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_transport.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_transport.py
@@ -1,12 +1,14 @@
# 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
+
import json
from marionette_driver.transport import (
Command,
Proto2Command,
Proto2Response,
Response,
)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
@@ -1,12 +1,14 @@
# 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
+
import urllib
from marionette_driver.by import By
from marionette_driver.errors import ElementNotInteractableException
from marionette_driver.keys import Keys
from marionette_harness import MarionetteTestCase, skip, skip_if_mobile
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestVisibility(MarionetteTestCase):
def testShouldAllowTheUserToTellIfAnElementIsDisplayedOrNot(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_wait.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_wait.py
@@ -1,12 +1,14 @@
# 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
+
import sys
import time
from marionette_driver import errors, wait
from marionette_driver.wait import Wait
from marionette_harness import MarionetteTestCase
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_close_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_close_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestCloseWindow, self).setUp()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_close_content.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_close_content.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
def tearDown(self):
self.close_all_windows()
self.close_all_tabs()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_fullscreen.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_fullscreen.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase
class TestWindowFullscreen(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.max = self.marionette.execute_script("""
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_chrome.py
@@ -1,12 +1,14 @@
# 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
+
import types
from marionette_driver import By, errors, Wait
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_content.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_content.py
@@ -1,12 +1,14 @@
# 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
+
import types
from marionette_driver import By, errors, Wait
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_management.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_management.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from marionette_driver.errors import NoSuchWindowException
from marionette_harness import MarionetteTestCase, WindowManagerMixin, skip_if_mobile
class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase
class TestWindowMaximize(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.max = self.marionette.execute_script("""
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_minimize.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_minimize.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import InvalidArgumentException
from marionette_harness import MarionetteTestCase
class TestWindowMinimize(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
@@ -1,12 +1,17 @@
# 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 marionette_driver.errors import InvalidArgumentException
from marionette_harness import MarionetteTestCase
class TestPosition(MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_status_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_status_chrome.py
@@ -1,12 +1,14 @@
# 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
+
import os
import sys
# add this directory to the path
sys.path.append(os.path.dirname(__file__))
from test_window_status_content import TestNoSuchWindowContent
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_status_content.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_status_content.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from marionette_driver.errors import NoSuchWindowException
from marionette_harness import MarionetteTestCase, WindowManagerMixin, skip_if_mobile
class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_type_chrome.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_type_chrome.py
@@ -1,12 +1,14 @@
# 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 marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestWindowTypeChrome(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestWindowTypeChrome, self).setUp()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_with_using_context.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_with_using_context.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.decorators import using_context
from marionette_driver.errors import MarionetteException
from marionette_harness import MarionetteTestCase
class TestSetContext(MarionetteTestCase):
def setUp(self):
--- a/testing/marionette/harness/setup.py
+++ b/testing/marionette/harness/setup.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
import os
import re
from setuptools import find_packages, setup
THIS_DIR = os.path.dirname(os.path.realpath(__name__))
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -1,13 +1,17 @@
# 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, unicode_literals
+from __future__ import (
+ absolute_import,
+ print_function,
+ unicode_literals
+)
import argparse
import os
import sys
from mach.decorators import (
CommandArgument,
CommandProvider,
@@ -74,18 +78,18 @@ class MachCommands(MachCommandBase):
@Command("marionette-test",
category="testing",
description="Remote control protocol to Gecko, used for functional UI tests and browser automation.",
conditions=[is_firefox_or_android],
parser=create_parser_tests,
)
def run_marionette_test(self, tests, **kwargs):
- print >>sys.stderr, ("warning: ./mach marionette-test is deprecated; "
- "please use ./mach marionette test")
+ print (sys.stderr, ("warning: ./mach marionette-test is deprecated; "
+ "please use ./mach marionette test"))
if "test_objects" in kwargs:
tests = []
for obj in kwargs["test_objects"]:
tests.append(obj["file_relpath"])
del kwargs["test_objects"]
if not kwargs.get("binary") and conditions.is_firefox(self):
@@ -151,13 +155,13 @@ class Marionette(MachCommandBase):
host, port = http.split(":")
host = host or "127.0.0.1"
port = int(port)
handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer((host, int(port)), handler)
- print "serving at %s:%s" % (host, port)
+ print("serving at %s:%s" % (host, port))
os.chdir(os.path.join(self.srcdir, "doc"))
httpd.serve_forever()
return proc.returncode
--- a/testing/marionette/mach_test_package_commands.py
+++ b/testing/marionette/mach_test_package_commands.py
@@ -1,12 +1,17 @@
# 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
+)
+
import argparse
import os
import sys
from functools import partial
from mach.decorators import (
CommandProvider,
Command,
--- a/testing/marionette/puppeteer/firefox/docs/conf.py
+++ b/testing/marionette/puppeteer/firefox/docs/conf.py
@@ -7,16 +7,18 @@
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
+from __future__ import absolute_import
+
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/__init__.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/__init__.py
@@ -1,9 +1,11 @@
# 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 firefox_puppeteer.mixins import PuppeteerMixin
from firefox_puppeteer.puppeteer import Puppeteer
__version__ = '52.1.0'
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/appinfo.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/appinfo.py
@@ -1,12 +1,14 @@
# 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 firefox_puppeteer.base import BaseLib
class AppInfo(BaseLib):
"""This class provides access to various attributes of AppInfo.
For more details on AppInfo, visit:
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Mozmill_tests/Shared_Modules/UtilsAPI/appInfo
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/keys.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/keys.py
@@ -1,12 +1,14 @@
# 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
+
import marionette_driver
class Keys(marionette_driver.keys.Keys):
"""Proxy to marionette's keys with an "accel" provided for convenience
testing across platforms."""
def __init__(self, marionette):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/l10n.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/l10n.py
@@ -3,16 +3,18 @@
# You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------
# DEPRECATED module
# -----------------
# Replace its use in tests when Firefox 45 ESR support ends with
# marionette_driver.localization.L10n
+from __future__ import absolute_import
+
import copy
from marionette_driver.errors import (
NoSuchElementException,
UnknownCommandException,
)
from marionette_driver.localization import L10n as L10nMarionette
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/places.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/places.py
@@ -1,12 +1,14 @@
# 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 collections import namedtuple
from time import sleep
from marionette_driver.errors import MarionetteException
from firefox_puppeteer.base import BaseLib
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/security.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/security.py
@@ -1,12 +1,14 @@
# 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
+
import re
from firefox_puppeteer.base import BaseLib
from firefox_puppeteer.errors import NoCertificateError
class Security(BaseLib):
"""Low-level access to security (SSL, TLS) related information."""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/software_update.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/software_update.py
@@ -1,12 +1,14 @@
# 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
+
import ConfigParser
import os
import re
import sys
import mozinfo
from firefox_puppeteer.base import BaseLib
@@ -361,18 +363,18 @@ class SoftwareUpdate(BaseLib):
:param update_url: URL to the update snippet
"""
import urllib2
try:
response = urllib2.urlopen(update_url)
return response.read()
except urllib2.URLError:
exc, val, tb = sys.exc_info()
- raise Exception, "Failed to retrieve update snippet '{}': {}".format(
- update_url, val), tb
+ raise Exception("Failed to retrieve update snippet '{}': {}".format(
+ update_url, val), tb)
def get_formatted_update_url(self, force=False):
"""Retrieve the formatted AUS update URL the update snippet is retrieved from.
:param force: Boolean flag to force an update check
:returns: The URL of the update snippet
"""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/utils.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/utils.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import MarionetteException
from firefox_puppeteer.base import BaseLib
class Utils(BaseLib):
"""Low-level access to utility actions."""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/base.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/base.py
@@ -1,12 +1,14 @@
# 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
+
class BaseLib(object):
"""A base class that handles lazily setting the "client" class attribute."""
def __init__(self, marionette):
self._marionette = marionette
@property
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/decorators.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/decorators.py
@@ -1,12 +1,14 @@
# 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 functools import wraps
from importlib import import_module
class use_class_as_property(object):
"""
This decorator imports a library module and sets an instance
of the associated class as an attribute on the Puppeteer
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/errors.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/errors.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.errors import MarionetteException
class NoCertificateError(MarionetteException):
pass
class UnexpectedWindowTypeError(MarionetteException):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/mixins.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/mixins.py
@@ -1,12 +1,14 @@
# 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 firefox_puppeteer.puppeteer import Puppeteer
from firefox_puppeteer.ui.browser.window import BrowserWindow
class PuppeteerMixin(object):
"""Mix-in class for Firefox specific API modules exposed to test scope.
It also provides common set-up and tear-down code for Firefox tests.
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/puppeteer.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/puppeteer.py
@@ -1,12 +1,14 @@
# 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 decorators import use_class_as_property
class Puppeteer(object):
"""The puppeteer class is used to expose additional API and UI libraries.
Each library can be referenced by its puppeteer name as a member of a
Puppeteer instance. For example, the `current_window` member of the
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/deck.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from firefox_puppeteer.ui.base import UIBaseLib
from firefox_puppeteer.ui.deck import Panel
class Deck(UIBaseLib):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/window.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/about_window/window.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from firefox_puppeteer.ui.about_window.deck import Deck
from firefox_puppeteer.ui.windows import BaseWindow, Windows
class AboutWindow(BaseWindow):
"""Representation of the About window."""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/base.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/base.py
@@ -1,12 +1,14 @@
# 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 marionette_driver.marionette import HTMLElement
from firefox_puppeteer.base import BaseLib
from firefox_puppeteer.ui.windows import BaseWindow
class UIBaseLib(BaseLib):
"""A base class for all UI element wrapper classes inside a chrome window."""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/notifications.py
@@ -1,12 +1,14 @@
# 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
from marionette_driver import By
from firefox_puppeteer.ui.base import UIBaseLib
class BaseNotification(UIBaseLib):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/tabbar.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import (
By, Wait
)
from marionette_driver.errors import NoSuchElementException
import firefox_puppeteer.errors as errors
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/toolbars.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/toolbars.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By, keys, Wait
from firefox_puppeteer.ui.base import UIBaseLib
class NavBar(UIBaseLib):
"""Provides access to the DOM elements contained in the
navigation bar as well as the location bar."""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By, Wait
from marionette_driver.errors import NoSuchElementException
from firefox_puppeteer.ui.about_window.window import AboutWindow
from firefox_puppeteer.ui.browser.notifications import (
AddOnInstallBlockedNotification,
AddOnInstallConfirmationNotification,
AddOnInstallCompleteNotification,
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/deck.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/deck.py
@@ -1,12 +1,14 @@
# 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 firefox_puppeteer.ui.base import UIBaseLib
class Panel(UIBaseLib):
def __eq__(self, other):
return self.element.get_attribute('id') == other.element.get_attribute('id')
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/menu.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/menu.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from marionette_driver.errors import NoSuchElementException
from firefox_puppeteer.base import BaseLib
from firefox_puppeteer.ui.base import DOMElement
class MenuBar(BaseLib):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/deck.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/deck.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By, Wait
from firefox_puppeteer.ui.base import UIBaseLib
from firefox_puppeteer.ui.deck import Panel
class Deck(UIBaseLib):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/window.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/pageinfo/window.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By
from firefox_puppeteer.ui.pageinfo.deck import Deck
from firefox_puppeteer.ui.windows import BaseWindow, Windows
class PageInfoWindow(BaseWindow):
"""Representation of a page info window."""
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/__init__.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/__init__.py
@@ -1,5 +1,7 @@
# 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 dialog import UpdateWizardDialog
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/dialog.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/dialog.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By, Wait
from firefox_puppeteer.ui.update_wizard.wizard import Wizard
from firefox_puppeteer.ui.windows import BaseWindow, Windows
# Bug 1143020 - Subclass from BaseDialog ui class with possible wizard mixin
class UpdateWizardDialog(BaseWindow):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/wizard.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By, Wait
from firefox_puppeteer.ui.base import UIBaseLib
from firefox_puppeteer.ui.deck import Panel
class Wizard(UIBaseLib):
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/windows.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/ui/windows.py
@@ -1,12 +1,14 @@
# 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 marionette_driver import By, Wait
from marionette_driver.errors import NoSuchWindowException
from marionette_driver.keys import Keys
import firefox_puppeteer.errors as errors
from firefox_puppeteer.api.l10n import L10n
from firefox_puppeteer.base import BaseLib
--- a/testing/marionette/puppeteer/firefox/setup.py
+++ b/testing/marionette/puppeteer/firefox/setup.py
@@ -1,12 +1,13 @@
# 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
import os
import re
from setuptools import setup, find_packages
THIS_DIR = os.path.dirname(os.path.realpath(__name__))