Permalink
Browse files

Only tear down sauceTunnel if its started

  • Loading branch information...
1 parent 8147780 commit c62f61987c44111f785deafb865004dc30d8ba4c @dcramer committed Jan 24, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 saucelabs/__init__.py
View
@@ -59,6 +59,7 @@ def __init__(self, host, port, browser, sauceUsername, sauceApiKey, sauceDomain,
self.sauceApiKey = sauceApiKey
self.sauceConnect = sauceConnect
self.sauceDomain = sauceDomain
+ self.sauceTunnel = None
self.serverHost = host
self.serverPort = port
@@ -105,8 +106,9 @@ def start_sauce_tunnel(self):
raise Exception('sauce_connect failed to come online in %s seconds' % SAUCE_CONNECT_TIMEOUT)
def stop_sauce_tunnel(self):
- self.sauceTunnel.terminate()
- self.sauceTunnel.wait()
+ if self.sauceTunnel:
+ self.sauceTunnel.terminate()
+ self.sauceTunnel.wait()
def start_selenium(self, *args, **kwargs):
result = self.get_string("getNewBrowserSession", [self.browserStartCommand, self.browserURL, self.extensionJs])
@@ -130,7 +132,7 @@ def stop(self, *args, **kwargs):
"Completes Sauce OnDemand tunnel connection."
result = self.stop_selenium(*args, **kwargs)
-
+
self.stop_sauce_tunnel()
return result

0 comments on commit c62f619

Please sign in to comment.