Bug 1321775 - Better handling for client property in Marionette class. draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 02 Dec 2016 11:48:07 +0100
changeset 447041 73639ffccd5042fc8522cfb298f95ee20e3be738
parent 446884 6f39c69810f258b4108f8ee88048c5b690a503a2
child 447049 23acaa51f28b70f848fed33ed1ba3f14764a1c03
push id37952
push userbmo:hskupin@gmail.com
push dateFri, 02 Dec 2016 10:53:37 +0000
bugs1321775
milestone53.0a1
Bug 1321775 - Better handling for client property in Marionette class. 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.process_id = None
         self.profile = None
         self.window = None
         self.chrome_window = None
         self.baseurl = baseurl
@@ -1303,17 +1304,19 @@ class Marionette(object):
                 self._send_message("deleteSession")
         finally:
             if reset_session_id:
                 self.session_id = None
             self.session = None
             self.process_id = None
             self.profile = None
             self.window = None
-            self.client.close()
+
+            if self.client:
+                self.client.close()
 
     @property
     def session_capabilities(self):
         """A JSON dictionary representing the capabilities of the
         current session.
 
         """
         return self.session