[Checkins] SVN: gocept.selenium/trunk/src/gocept/selenium/plonetesting/test Refactor test layers to promote reuse and make structure similar to our other flavours (e.g. ztk): first, there's the fixture, and then we wrap a selenium layer around it

Wolfgang Schnerring wosc at wosc.de
Tue Dec 28 05:22:33 EST 2010


Log message for revision 119186:
  Refactor test layers to promote reuse and make structure similar to our other flavours (e.g. ztk): first, there's the fixture, and then we wrap a selenium layer around it
  

Changed:
  U   gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing_plone.py
  U   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py
  U   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py
  U   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py

-=-
Modified: gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing.py	2010-12-28 10:09:03 UTC (rev 119185)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing.py	2010-12-28 10:22:32 UTC (rev 119186)
@@ -18,7 +18,7 @@
 import zope.configuration.xmlconfig
 
 
-class Isolation(plone.testing.Layer):
+class Layer(plone.testing.Layer):
 
     defaultBases = (plone.testing.z2.STARTUP,)
 
@@ -28,9 +28,14 @@
             context=self['configurationContext'])
 
 
-ISOLATION = Isolation()
+layer = Layer()
 
 
+selenium_layer = plone.testing.Layer(
+    bases=(layer, gocept.selenium.plonetesting.SELENIUM),
+    name='layer')
+
+
 class IsolationTestHelper(object):
     """
     plone.testing implementation of methods needed by common isolation tests

Added: gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing_plone.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing_plone.py	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/testing_plone.py	2010-12-28 10:22:32 UTC (rev 119186)
@@ -0,0 +1,29 @@
+#############################################################################
+#
+# Copyright (c) 2010 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import gocept.selenium.plonetesting
+import gocept.selenium.plonetesting.testing
+import plone.app.testing.layers
+import plone.testing
+
+
+layer = plone.testing.Layer(
+    bases=(gocept.selenium.plonetesting.testing.layer,
+           plone.app.testing.layers.PLONE_FIXTURE),
+    name='Isolation')
+
+
+selenium_layer = plone.testing.Layer(
+    bases=(layer, gocept.selenium.plonetesting.SELENIUM),
+    name='layer')

Modified: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py	2010-12-28 10:09:03 UTC (rev 119185)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py	2010-12-28 10:22:32 UTC (rev 119186)
@@ -15,26 +15,16 @@
 from plone.app.testing.layers import SITE_OWNER_NAME
 from plone.app.testing.layers import SITE_OWNER_PASSWORD
 import gocept.selenium.plonetesting
-import gocept.selenium.plonetesting.testing
+import gocept.selenium.plonetesting.testing_plone
 import gocept.selenium.tests.isolation
-import plone.app.testing.layers
-import plone.testing
-import plone.testing.z2
 import unittest
 
 
-layer = plone.testing.Layer(
-    bases=(gocept.selenium.plonetesting.SELENIUM,
-           gocept.selenium.plonetesting.testing.ISOLATION,
-           plone.app.testing.layers.PLONE_FIXTURE),
-    name='layer')
-
-
 class Plone3Tests(gocept.selenium.tests.isolation.IsolationTests,
                   gocept.selenium.plonetesting.testing.IsolationTestHelper,
                   gocept.selenium.plonetesting.TestCase):
 
-    layer = layer
+    layer = gocept.selenium.plonetesting.testing_plone.selenium_layer
 
     def test_plone_login(self):
         sel = self.selenium

Modified: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py	2010-12-28 10:09:03 UTC (rev 119185)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py	2010-12-28 10:22:32 UTC (rev 119186)
@@ -15,26 +15,16 @@
 from plone.app.testing.layers import SITE_OWNER_NAME
 from plone.app.testing.layers import SITE_OWNER_PASSWORD
 import gocept.selenium.plonetesting
-import gocept.selenium.plonetesting.testing
+import gocept.selenium.plonetesting.testing_plone
 import gocept.selenium.tests.isolation
-import plone.app.testing.layers
-import plone.testing
-import plone.testing.z2
 import unittest
 
 
-layer = plone.testing.Layer(
-    bases=(gocept.selenium.plonetesting.SELENIUM,
-           gocept.selenium.plonetesting.testing.ISOLATION,
-           plone.app.testing.layers.PLONE_FIXTURE),
-    name='layer')
-
-
 class Plone4Tests(gocept.selenium.tests.isolation.IsolationTests,
                   gocept.selenium.plonetesting.testing.IsolationTestHelper,
                   gocept.selenium.plonetesting.TestCase):
 
-    layer = layer
+    layer = gocept.selenium.plonetesting.testing_plone.selenium_layer
 
     def test_plone_login(self):
         sel = self.layer['selenium']

Modified: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py	2010-12-28 10:09:03 UTC (rev 119185)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py	2010-12-28 10:22:32 UTC (rev 119186)
@@ -15,21 +15,14 @@
 import gocept.selenium.plonetesting
 import gocept.selenium.plonetesting.testing
 import gocept.selenium.tests.isolation
-import plone.testing
 import unittest
 
 
-layer = plone.testing.Layer(
-    bases=(gocept.selenium.plonetesting.SELENIUM,
-           gocept.selenium.plonetesting.testing.ISOLATION,),
-    name='layer')
-
-
 class Zope2Tests(gocept.selenium.tests.isolation.IsolationTests,
                  gocept.selenium.plonetesting.testing.IsolationTestHelper,
                  gocept.selenium.plonetesting.TestCase):
 
-    layer = layer
+    layer = gocept.selenium.plonetesting.testing.selenium_layer
 
 
 def test_suite():



More information about the checkins mailing list