[Checkins] SVN: gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py Make plonetesting layer inherit from base.Layer
Wolfgang Schnerring
wosc at wosc.de
Tue Dec 28 04:23:32 EST 2010
Log message for revision 119177:
Make plonetesting layer inherit from base.Layer
Changed:
U gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py
-=-
Modified: gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py 2010-12-28 09:22:41 UTC (rev 119176)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py 2010-12-28 09:23:31 UTC (rev 119177)
@@ -12,32 +12,39 @@
#
##############################################################################
-from plone.testing import Layer
-from plone.testing.z2 import ZSERVER_FIXTURE
-import gocept.selenium.selenese
-import selenium
+import gocept.selenium.base
+import plone.testing
+import plone.testing.z2
-class Selenium(Layer):
+# XXX it would be nicer to reuse plone.testing.z2.ZSERVER_FIXTURE,
+# but we can't since we want to be able to override host/port via the
+# mechanisms exposed by gocept.selenium.base.Layer
+ZSERVER = plone.testing.z2.ZServer()
- defaultBases = (ZSERVER_FIXTURE, )
- _rc_server = 'localhost'
- _rc_port = 4444
- _browser = '*firefox'
+class Layer(gocept.selenium.base.Layer, plone.testing.Layer):
- def setUp(self):
- super(Selenium, self).setUp()
- self.selenium = self['selenium'] = selenium.selenium(
- self._rc_server, self._rc_port, self._browser,
- 'http://%s:%s/' % (self['host'], self['port']))
- self.selenium.start()
- self['selenese'] = gocept.selenium.selenese.Selenese(
- self.selenium, self['host'], self['port'])
+ defaultBases = (ZSERVER,)
- def tearDown(self):
- super(Selenium, self).tearDown()
- self.selenium.stop()
+ def __init__(self, *args, **kw):
+ # we can't use super, since our base classes are not built for multiple
+ # inheritance (they don't consistently call super themselves, so parts
+ # of the hierarchy might be missed).
+ #
+ # plone.testing.Layer has noops for everything except __init__, so this
+ # only matters here.
+ gocept.selenium.base.Layer.__init__(self)
+ plone.testing.Layer.__init__(self, *args, **kw)
+ ZSERVER.host = self.host
+ ZSERVER.port = self.port
-SELENIUM = Selenium()
+ def testSetUp(self):
+ super(Layer, self).testSetUp()
+ # conform to the plone.testing contract that layers expose interesting
+ # stuff via getitem
+ self['selenese'] = self.selenium
+
+
+SELENIUM = Layer()
More information about the checkins
mailing list