[Checkins] SVN: gocept.selenium/trunk/ use plone.testing layers correctly

Godefroid Chapelle gotcha at bubblenet.be
Tue Dec 21 08:30:30 EST 2010


Log message for revision 119028:
  use plone.testing layers correctly
  

Changed:
  U   gocept.selenium/trunk/plonetesting-plone4.cfg
  U   gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting4/test_plone4.py
  A   gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py
  U   gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py
  U   gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/test_zope212.py

-=-
Modified: gocept.selenium/trunk/plonetesting-plone4.cfg
===================================================================
--- gocept.selenium/trunk/plonetesting-plone4.cfg	2010-12-21 10:18:11 UTC (rev 119027)
+++ gocept.selenium/trunk/plonetesting-plone4.cfg	2010-12-21 13:30:29 UTC (rev 119028)
@@ -10,13 +10,16 @@
 
 [sources]
 plone.testing = svn https://svn.plone.org/svn/plone/plone.testing/trunk
+plone.app.testing = svn https://svn.plone.org/svn/plone/plone.app.testing/trunk
 
 [versions]
 PILwoTK = 1.1.6.4
+plone.testing = 4.0a3
+plone.app.testing = 4.0a3
 
 [test]
 recipe = zc.recipe.testrunner
-defaults = ["--ignore_dir=ztk", "--ignore_dir=static", "--tests-pattern=plonetesting4"]
+defaults = ["--ignore_dir=ztk", "--ignore_dir=static", "--ignore_dir=plonetesting3", "--tests-pattern=plonetesting"]
 eggs = ${instance:eggs}
        plone.app.testing
 

Modified: gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting4/test_plone4.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting4/test_plone4.py	2010-12-21 10:18:11 UTC (rev 119027)
+++ gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting4/test_plone4.py	2010-12-21 13:30:29 UTC (rev 119028)
@@ -13,19 +13,32 @@
 ##############################################################################
 
 import unittest
-import gocept.selenium.zope2
-from gocept.selenium.zope2.plonetesting import ISOLATION
-import gocept.selenium.tests.isolation
 
+import plone.testing
+from plone.testing.z2 import FunctionalTesting
+
 from plone.app.testing.layers import PLONE_FIXTURE
 from plone.app.testing.layers import SITE_OWNER_NAME
 from plone.app.testing.layers import SITE_OWNER_PASSWORD
 
+import gocept.selenium.zope2
+import gocept.selenium.tests.isolation
+from gocept.selenium.zope2 import plonetesting
+from gocept.selenium.tests import isolation_layer
 
+PLONE_ISOLATION = FunctionalTesting(
+    bases=(isolation_layer.ISOLATION, PLONE_FIXTURE),
+    name="gocept.selenium:PloneIsolation")
+
+PLONE_SELENIUM = plone.testing.Layer(
+    bases=(plonetesting.SELENIUM, PLONE_ISOLATION,),
+    name="gocept.selenium:Plone4")
+
+
 class Plone4Tests(gocept.selenium.tests.isolation.IsolationTests,
-                 gocept.selenium.plone.TestCase):
+                 plonetesting.TestCase):
 
-    layer = gocept.selenium.zope2.Layer(PLONE_FIXTURE, ISOLATION)
+    layer = PLONE_SELENIUM
 
     def test_plone_login(self):
         sel = self.selenium

Added: gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py	2010-12-21 13:30:29 UTC (rev 119028)
@@ -0,0 +1,22 @@
+from zope.configuration import xmlconfig
+
+from plone.testing import Layer
+from plone.testing.z2 import STARTUP
+from plone.testing.z2 import FunctionalTesting
+
+import gocept.selenium.zope2
+
+
+class Isolation(Layer):
+
+    defaultBases = (STARTUP, )
+
+    def setUp(self):
+        context = self['configurationContext']
+        xmlconfig.file('testing.zcml', package=gocept.selenium.zope2,
+            context=context)
+
+ISOLATION = Isolation()
+
+FUNCTIONAL_ISOLATION = FunctionalTesting(bases=(ISOLATION,),
+    name="gocept.selenium:FunctionalIsolation")

Modified: gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py	2010-12-21 10:18:11 UTC (rev 119027)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py	2010-12-21 13:30:29 UTC (rev 119028)
@@ -1,17 +1,37 @@
-from zope.configuration import xmlconfig
+import selenium
+import unittest
 
 from plone.testing import Layer
-from plone.testing.z2 import STARTUP
+from plone.testing.z2 import ZSERVER_FIXTURE
 
-from gocept.selenium import zope2
+import gocept.selenium.selenese
 
 
-class Isolation(Layer):
+class Selenium(Layer):
 
-    defaultBases = (STARTUP,)
+    defaultBases = (ZSERVER_FIXTURE, )
 
+    _rc_server = 'localhost'
+    _rc_port = 4444
+    _browser = '*firefox'
+
     def setUp(self):
-        context = self['configurationContext']
-        xmlconfig.file('testing.zcml', package=zope2, context=context)
+        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()
 
-ISOLATION = Isolation()
+    def tearDown(self):
+        super(Selenium, self).tearDown()
+        self.selenium.stop()
+
+SELENIUM = Selenium()
+
+
+class TestCase(unittest.TestCase):
+
+    def setUp(self):
+        super(TestCase, self).setUp()
+        self.selenium = gocept.selenium.selenese.Selenese(
+            self.layer['selenium'], self.layer['host'], self.layer['port'])

Modified: gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/test_zope212.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/test_zope212.py	2010-12-21 10:18:11 UTC (rev 119027)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/test_zope212.py	2010-12-21 13:30:29 UTC (rev 119028)
@@ -11,17 +11,23 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+import unittest
 
-import unittest
-import gocept.selenium.zope2
+import plone.testing
 from gocept.selenium.zope2 import plonetesting
 import gocept.selenium.tests.isolation
+from gocept.selenium.tests import isolation_layer
 
 
+ZOPE2_ISOLATION = plone.testing.Layer(
+    bases=(plonetesting.SELENIUM, isolation_layer.FUNCTIONAL_ISOLATION,),
+    name="gocept.selenium:Zope2.12")
+
+
 class Zope212Tests(gocept.selenium.tests.isolation.IsolationTests,
-                 gocept.selenium.zope2.TestCase):
+                 plonetesting.TestCase):
 
-    layer = gocept.selenium.zope2.Layer(plonetesting.ISOLATION)
+    layer = ZOPE2_ISOLATION
 
 
 def test_suite():



More information about the checkins mailing list