Bug 1321775 - Better handling for client property in Marionette class. r=ato a=test-only
authorHenrik Skupin <mail@hskupin.info>
Fri, 02 Dec 2016 18:22:00 +0100
changeset 352840 46049b21980d67b13d6915c052a3025c273a1788
parent 352839 3343d88f45c3ea4ad1ae7877e5791539570ab583
child 352841 8a3453d75b8da4f0b112257688ced3f3fc381e8b
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1321775
milestone52.0a2
Bug 1321775 - Better handling for client property in Marionette class. r=ato a=test-only MozReview-Commit-ID: KNe3DIrnBlh
testing/marionette/client/marionette_driver/marionette.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -565,16 +565,17 @@ class Marionette(object):
         :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
+        self.client = None
         self.instance = None
         self.session = None
         self.session_id = None
         self.window = None
         self.chrome_window = None
         self.baseurl = baseurl
         self._test_name = None
         self.socket_timeout = socket_timeout
@@ -1296,17 +1297,19 @@ class Marionette(object):
         try:
             if send_request:
                 self._send_message("deleteSession")
         finally:
             if reset_session_id:
                 self.session_id = None
             self.session = None
             self.window = None
-            self.client.close()
+
+            if self.client is not None:
+                self.client.close()
 
     @property
     def session_capabilities(self):
         """A JSON dictionary representing the capabilities of the
         current session.
 
         """
         return self.session