Bug 1050511 - Modify import of marionette harness to avoid a mismatch in assertRaises when running through mach. r=gps
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -40,17 +40,16 @@ SEARCH_PATHS = [
'dom/bindings/parser',
'layout/tools/reftest',
'other-licenses/ply',
'xpcom/idl-parser',
'testing',
'testing/xpcshell',
'testing/web-platform',
'testing/web-platform/harness',
- 'testing/marionette/client',
'testing/marionette/client/marionette',
'testing/marionette/transport',
'testing/mozbase/mozcrash',
'testing/mozbase/mozdebug',
'testing/mozbase/mozdevice',
'testing/mozbase/mozfile',
'testing/mozbase/mozhttpd',
'testing/mozbase/mozlog',
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -1,14 +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 __future__ import unicode_literals
+import imp
import os
import sys
import argparse
from mozlog.structured import commandline
from mozbuild.base import (
MachCommandBase,
@@ -31,17 +32,27 @@ VARIANT=eng ./build.sh
'''
# A parser that will accept structured logging commandline arguments.
_parser = argparse.ArgumentParser()
commandline.add_logging_group(_parser)
def run_marionette(tests, b2g_path=None, emulator=None, testtype=None,
address=None, binary=None, topsrcdir=None, **kwargs):
- from marionette.runtests import (
+
+ # Import the harness directly and under a different name here to avoid
+ # "marionette" being importable from two locations when "testing/marionette/client"
+ # is on sys.path.
+ # See bug 1050511.
+ path = os.path.join(topsrcdir, 'testing/marionette/client/marionette/runtests.py')
+ with open(path, 'r') as fh:
+ imp.load_module('marionetteharness', fh, path,
+ ('.py', 'r', imp.PY_SOURCE))
+
+ from marionetteharness import (
MarionetteTestRunner,
BaseMarionetteOptions,
startTestRunner
)
parser = BaseMarionetteOptions()
commandline.add_logging_group(parser)
options, args = parser.parse_args()