Bug 1283216 - Fix by allowing the marionette client object to be constructed with the build from the local environment as default. r?ato draft
authoranjul tyagi <anjul.ten@gmail.com>
Tue, 14 Feb 2017 12:16:40 +0530
changeset 483341 b2afeedfbca9fb179f5c395627fca9fc6d5bef31
parent 483291 195049fabb7ac5709e5f75614ba630ba3d1b5a9b
child 545634 046d80337a9e415928badc4fa0071e7700ce34ad
push id45306
push userbmo:anjul.ten@gmail.com
push dateTue, 14 Feb 2017 06:48:35 +0000
reviewersato
bugs1283216
milestone54.0a1
Bug 1283216 - Fix by allowing the marionette client object to be constructed with the build from the local environment as default. r?ato MozReview-Commit-ID: 77jewG68SAW *** Bug 1283216 - Fix by allowing the marionette client object to be constructed with the build from the local environment as default. r?ato MozReview-Commit-ID: 1j4teWjIFgd
testing/marionette/client/marionette_driver/marionette.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -17,16 +17,24 @@ from contextlib import contextmanager
 import errors
 import transport
 
 from .decorators import do_process_check
 from .geckoinstance import GeckoInstance
 from .keys import Keys
 from .timeout import Timeouts
 
+try:
+    from mozbuild.base import (
+        MozbuildObject
+    )
+    build = MozbuildObject.from_environment()
+except ImportError:
+    build = None
+
 WEBELEMENT_KEY = "ELEMENT"
 W3C_WEBELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf"
 
 
 class HTMLElement(object):
     """Represents a DOM Element."""
 
     def __init__(self, marionette, id):
@@ -575,17 +583,20 @@ class Marionette(object):
             `app`.
         :param app: Type of ``instance_class`` to use for managing app
             instance. See ``marionette_driver.geckoinstance``.
         :param instance_args: Arguments to pass to ``instance_class``.
 
         """
         self.host = host
         self.port = self.local_port = int(port)
-        self.bin = bin
+        if bin is None and build is not None:
+            self.bin = build.get_binary_path()
+        else:
+            self.bin = bin
         self.client = None
         self.instance = None
         self.session = None
         self.session_id = None
         self.process_id = None
         self.profile = None
         self.window = None
         self.chrome_window = None