[Checkins] SVN: gocept.selenium/trunk/src/gocept/selenium/base.py Stop selenium only once in the atexit function.

Jan-Jaap Driessen jdriessen at thehealthagency.com
Sun Jan 2 15:12:32 EST 2011


Log message for revision 119260:
  Stop selenium only once in the atexit function.

Changed:
  U   gocept.selenium/trunk/src/gocept/selenium/base.py

-=-
Modified: gocept.selenium/trunk/src/gocept/selenium/base.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/base.py	2011-01-02 19:51:53 UTC (rev 119259)
+++ gocept.selenium/trunk/src/gocept/selenium/base.py	2011-01-02 20:12:32 UTC (rev 119260)
@@ -46,6 +46,11 @@
         else:
             self.__name__ = self.__class__.__name__
 
+    def _stop_selenium(self):
+        # Only stop selenium if it is still active.
+        if self.seleniumrc.sessionId is not None:
+            self.seleniumrc.stop()
+
     def setUp(self):
         self.seleniumrc = selenium.selenium(
             self._server, self._port, self._browser,
@@ -57,7 +62,7 @@
                 'Failed to connect to Selenium RC server at %s:%s,'
                 ' is it running? (%s)'
                 % (self._server, self._port, e))
-        atexit.register(self.seleniumrc.stop)
+        atexit.register(self._stop_selenium)
         speed = os.environ.get('GOCEPT_SELENIUM_SPEED')
         if speed is not None:
             self.seleniumrc.set_speed(speed)



More information about the checkins mailing list