[Checkins] SVN: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/ Remove `SaneLayer` base class, it doesn't serve any purpose, really

Wolfgang Schnerring wosc at wosc.de
Sat Dec 4 04:22:59 EST 2010


Log message for revision 118699:
  Remove `SaneLayer` base class, it doesn't serve any purpose, really
  

Changed:
  U   gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/base.py
  U   gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py
  U   gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/wsgi/__init__.py

-=-
Modified: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/base.py
===================================================================
--- gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/base.py	2010-12-04 09:14:18 UTC (rev 118698)
+++ gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/base.py	2010-12-04 09:22:59 UTC (rev 118699)
@@ -18,7 +18,7 @@
 import gocept.selenium.selenese
 
 
-class LayerBase(object):
+class Layer(object):
 
     # hostname and port of the Selenium RC server
     _server = os.environ.get('GOCEPT_SELENIUM_SERVER_HOST', 'localhost')
@@ -30,13 +30,13 @@
     host = os.environ.get('GOCEPT_SELENIUM_APP_HOST', 'localhost')
     port = int(os.environ.get('GOCEPT_SELENIUM_APP_PORT', 5698))
 
-    __name__ = 'Layer'
-
     def __init__(self, *bases):
         self.__bases__ = bases
         if self.__bases__:
             base = bases[0]
             self.__name__ = '(%s.%s)' % (base.__module__, base.__name__)
+        else:
+            self.__name__ = self.__class__.__name__
 
     def setUp(self):
         self.selenium = selenium.selenium(
@@ -51,39 +51,6 @@
         self.selenium.stop()
 
 
-class Layer(LayerBase):
-    __name__ = 'Layer'
-
-    def __init__(self, *bases):
-        self.__bases__ = bases
-        self.__name__ = '[%s].selenium' % (
-            '/'.join('%s.%s' % (x.__module__, x.__name__) for x in bases))
-
-    def testSetUp(self):
-        pass
-
-    def testTearDown(self):
-        pass
-
-
-class SaneLayer(LayerBase):
-    """Sane layer base class.
-
-    Sane test layer base class inspired by zope.component.testlayer.
-
-    The hack requires us to set __bases__, __module__ and __name__.
-    This fools zope.testrunner into thinking that this layer instance is
-    an object it can work with.
-    """
-
-    __bases__ = ()
-
-    def __init__(self, name=None):
-        if name is None:
-            name = self.__class__.__name__
-        self.__name__ = name
-
-
 class TestCase(object):
 
     def setUp(self):

Modified: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py
===================================================================
--- gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py	2010-12-04 09:14:18 UTC (rev 118698)
+++ gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/static/__init__.py	2010-12-04 09:22:59 UTC (rev 118699)
@@ -76,8 +76,12 @@
         self.server_close()
 
 
-class StaticFilesLayer(gocept.selenium.base.SaneLayer):
+class StaticFilesLayer(gocept.selenium.base.Layer):
 
+    def __init__(self):
+        # we don't need any __bases__
+        super(StaticFilesLayer, self).__init__()
+
     def setUp(self):
         super(StaticFilesLayer, self).setUp()
         self.server = None

Modified: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/wsgi/__init__.py
===================================================================
--- gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/wsgi/__init__.py	2010-12-04 09:14:18 UTC (rev 118698)
+++ gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/wsgi/__init__.py	2010-12-04 09:22:59 UTC (rev 118699)
@@ -29,7 +29,7 @@
             WSGIRequestHandler.log_request(self, *args)
 
 
-class Layer(gocept.selenium.base.SaneLayer):
+class Layer(gocept.selenium.base.Layer):
 
     application = None
 
@@ -37,7 +37,7 @@
         return app
 
     def setUp(self):
-        gocept.selenium.base.SaneLayer.setUp(self)
+        super(Layer, self).setUp()
 
         self.http = WSGIServer((self.host, self.port), LogWSGIRequestHandler)
         self.http.set_app(self.setup_wsgi_stack(self.application))
@@ -51,7 +51,7 @@
         self.thread.join()
         # Make the server really go away and give up the socket:
         self.http = None
-        gocept.selenium.base.SaneLayer.tearDown(self)
+        super(Layer, self).tearDown()
 
 
 class TestCase(unittest.TestCase):



More information about the checkins mailing list