[Checkins] SVN: gocept.selenium/trunk/ Clean up layers and ZCML loading for zope2/plone flavours

Wolfgang Schnerring wosc at wosc.de
Sun Dec 26 10:47:10 EST 2010


Log message for revision 119135:
  Clean up layers and ZCML loading for zope2/plone flavours
  
  * Don't prescribe any layer in the zope2.TestCase, that's not useful in general (since you almost always will need your own layer)
  * Remove loading the fixture's ZCML from the instance configuration, load it in a custom layer instead
  * Clean up the 2.10/later distinction (later Zope2 versions need to use ZopeLiteLayer)
  

Changed:
  U   gocept.selenium/trunk/plone.cfg
  U   gocept.selenium/trunk/plone4.cfg
  U   gocept.selenium/trunk/plonetesting-plone3.cfg
  U   gocept.selenium/trunk/plonetesting-plone4.cfg
  U   gocept.selenium/trunk/src/gocept/selenium/plone/__init__.py
  U   gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone3/test_plone3.py
  U   gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone4/test_plone4.py
  U   gocept.selenium/trunk/src/gocept/selenium/zope2/__init__.py
  U   gocept.selenium/trunk/src/gocept/selenium/zope2/testing.py
  D   gocept.selenium/trunk/src/gocept/selenium/zope2/testing.zcml
  U   gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope210/test_zope210.py
  U   gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope212/test_zope212.py
  U   gocept.selenium/trunk/zope2.cfg
  U   gocept.selenium/trunk/zope212.cfg

-=-
Modified: gocept.selenium/trunk/plone.cfg
===================================================================
--- gocept.selenium/trunk/plone.cfg	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/plone.cfg	2010-12-26 15:47:09 UTC (rev 119135)
@@ -25,7 +25,6 @@
 eggs = ${buildout:package}
     Plone
     PILwoTK
-zcml = gocept.selenium.tests.fixture
 
 [zope2]
 recipe = plone.recipe.zope2install

Modified: gocept.selenium/trunk/plone4.cfg
===================================================================
--- gocept.selenium/trunk/plone4.cfg	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/plone4.cfg	2010-12-26 15:47:09 UTC (rev 119135)
@@ -20,4 +20,3 @@
 eggs = ${buildout:package}
     Plone
     PILwoTK
-zcml = gocept.selenium.tests.fixture

Modified: gocept.selenium/trunk/plonetesting-plone3.cfg
===================================================================
--- gocept.selenium/trunk/plonetesting-plone3.cfg	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/plonetesting-plone3.cfg	2010-12-26 15:47:09 UTC (rev 119135)
@@ -42,7 +42,6 @@
     Plone
     PILwoTK
     plone.app.testing
-zcml = gocept.selenium.tests.fixture
 
 [omelette]
 recipe = collective.recipe.omelette

Modified: gocept.selenium/trunk/plonetesting-plone4.cfg
===================================================================
--- gocept.selenium/trunk/plonetesting-plone4.cfg	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/plonetesting-plone4.cfg	2010-12-26 15:47:09 UTC (rev 119135)
@@ -29,7 +29,6 @@
 eggs = ${buildout:package}
     Plone
     PILwoTK
-zcml = gocept.selenium.tests.fixture
 
 [omelette]
 recipe = collective.recipe.omelette

Modified: gocept.selenium/trunk/src/gocept/selenium/plone/__init__.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plone/__init__.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/plone/__init__.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -12,7 +12,6 @@
 #
 ##############################################################################
 
-from Products.PloneTestCase.layer import PloneSiteLayer
 import Products.PloneTestCase.PloneTestCase
 import gocept.selenium.base
 import gocept.selenium.zope2
@@ -22,8 +21,6 @@
                gocept.selenium.zope2.SandboxPatch,
                Products.PloneTestCase.PloneTestCase.FunctionalTestCase):
 
-    layer = gocept.selenium.zope2.Layer(PloneSiteLayer)
-
     def getRootFolder(self):
         """forward API-compatibility with zope.app.testing"""
         return self.app

Modified: gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone3/test_plone3.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone3/test_plone3.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone3/test_plone3.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -12,10 +12,12 @@
 #
 ##############################################################################
 
+from Products.PloneTestCase.layer import PloneSiteLayer
+import Products.PloneTestCase.PloneTestCase
+import gocept.selenium.tests.isolation
+import gocept.selenium.zope2
+import gocept.selenium.zope2.testing
 import unittest
-import gocept.selenium.zope2
-import gocept.selenium.tests.isolation
-import Products.PloneTestCase.PloneTestCase
 
 
 Products.PloneTestCase.PloneTestCase.setupPloneSite(id='plone')
@@ -24,6 +26,10 @@
 class PloneTests(gocept.selenium.tests.isolation.IsolationTests,
                  gocept.selenium.plone.TestCase):
 
+    layer = gocept.selenium.zope2.Layer(
+        PloneSiteLayer,
+        gocept.selenium.zope2.testing.Layer)
+
     def getDatabase(self):
         return gocept.selenium.zope2.get_current_db()
 

Modified: gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone4/test_plone4.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone4/test_plone4.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/plone/tests/plone4/test_plone4.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -12,21 +12,21 @@
 #
 ##############################################################################
 
-import unittest
-import gocept.selenium.zope2
-from gocept.selenium.zope2 import testing
-import gocept.selenium.tests.isolation
+from Products.PloneTestCase.layer import PloneSiteLayer
 import Products.PloneTestCase.PloneTestCase
+import gocept.selenium.tests.isolation
+import gocept.selenium.zope2
+import gocept.selenium.zope2.testing
 
-from Products.PloneTestCase.layer import PloneSiteLayer
-
 Products.PloneTestCase.PloneTestCase.setupPloneSite(id='plone')
 
 
 class Plone4Tests(gocept.selenium.tests.isolation.IsolationTests,
-                 gocept.selenium.plone.TestCase):
+                  gocept.selenium.plone.TestCase):
 
-    layer = gocept.selenium.zope2.Layer(PloneSiteLayer, testing.isolationLayer)
+    layer = gocept.selenium.zope2.Layer(
+        PloneSiteLayer,
+        gocept.selenium.zope2.testing.Layer)
 
     def getDatabase(self):
         return gocept.selenium.zope2.get_current_db()
@@ -41,7 +41,3 @@
         sel.click('name=submit')
         sel.waitForPageToLoad()
         sel.assertTextPresent('portal_owner')
-
-
-def test_suite():
-    return unittest.makeSuite(Plone4Tests)

Modified: gocept.selenium/trunk/src/gocept/selenium/zope2/__init__.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/__init__.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/__init__.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -21,15 +21,6 @@
 import gocept.selenium.base
 
 
-try:
-    # Zope 2 >= 2.11
-    import Testing.ZopeTestCase.layer
-    BASE_LAYERS = (Testing.ZopeTestCase.layer.ZopeLiteLayer, )
-except ImportError:
-    # Zope 2 < 2.11
-    BASE_LAYERS = ()
-
-
 class Layer(gocept.selenium.base.Layer):
 
     def setUp(self):
@@ -95,8 +86,6 @@
                SandboxPatch,
                Testing.ZopeTestCase.FunctionalTestCase):
 
-    layer = Layer(*BASE_LAYERS)
-
     def getRootFolder(self):
         """forward API-compatibility with zope.app.testing"""
         return self.app

Modified: gocept.selenium/trunk/src/gocept/selenium/zope2/testing.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/testing.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/testing.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -1,16 +1,34 @@
-from Products.Five import zcml
+#############################################################################
+#
+# 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.
+#
+##############################################################################
 
-from gocept.selenium import zope2
+import Products.Five.zcml
+import gocept.selenium.tests.fixture
+import gocept.selenium.zope2
 
 
-class IsolationLayer(object):
+class Layer(object):
 
-    __name__ = "gocept.selenium.tests.isolation"
-    __bases__ = ()
+    @classmethod
+    def setUp(cls):
+        Products.Five.zcml.load_config(
+            'configure.zcml', package=gocept.selenium.tests.fixture)
 
+
+# required for Zope2 >= 2.12
+class FiveLayer(object):
+
+    @classmethod
     def setUp(cls):
-        zcml.load_config('testing.zcml',
-            package=zope2)
-    setUp = classmethod(setUp)
-
-isolationLayer = IsolationLayer()
+        Products.Five.zcml.load_config(
+            'configure.zcml', package=Products.Five)

Deleted: gocept.selenium/trunk/src/gocept/selenium/zope2/testing.zcml
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/testing.zcml	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/testing.zcml	2010-12-26 15:47:09 UTC (rev 119135)
@@ -1,7 +0,0 @@
-<configure
-  xmlns="http://namespaces.zope.org/zope">
-
-  <include package="Products.Five" />
-  <include package="gocept.selenium.tests.fixture" />
-
-</configure>

Modified: gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope210/test_zope210.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope210/test_zope210.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope210/test_zope210.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -15,6 +15,7 @@
 import Testing.ZopeTestCase
 import gocept.selenium.tests.isolation
 import gocept.selenium.zope2
+import gocept.selenium.zope2.testing
 import unittest
 
 Testing.ZopeTestCase.installProduct('Five')
@@ -23,6 +24,8 @@
 class Zope2Tests(gocept.selenium.tests.isolation.IsolationTests,
                  gocept.selenium.zope2.TestCase):
 
+    layer = gocept.selenium.zope2.Layer(gocept.selenium.zope2.testing.Layer)
+
     def getDatabase(self):
         return gocept.selenium.zope2.get_current_db()
 

Modified: gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope212/test_zope212.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope212/test_zope212.py	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/tests/zope212/test_zope212.py	2010-12-26 15:47:09 UTC (rev 119135)
@@ -12,24 +12,23 @@
 #
 ##############################################################################
 
-from gocept.selenium.zope2 import BASE_LAYERS
-from gocept.selenium.zope2 import testing
 import Testing.ZopeTestCase
+import Testing.ZopeTestCase.layer
 import gocept.selenium.tests.isolation
 import gocept.selenium.zope2
-import unittest
+import gocept.selenium.zope2.testing
 
+
 Testing.ZopeTestCase.installProduct('Five')
 
 
 class Zope212Tests(gocept.selenium.tests.isolation.IsolationTests,
-                 gocept.selenium.zope2.TestCase):
+                   gocept.selenium.zope2.TestCase):
 
-    layer = gocept.selenium.zope2.Layer(testing.isolationLayer, *BASE_LAYERS)
+    layer = gocept.selenium.zope2.Layer(
+        Testing.ZopeTestCase.layer.ZopeLiteLayer,
+        gocept.selenium.zope2.testing.FiveLayer,
+        gocept.selenium.zope2.testing.Layer)
 
     def getDatabase(self):
         return gocept.selenium.zope2.get_current_db()
-
-
-def test_suite():
-    return unittest.makeSuite(Zope212Tests)

Modified: gocept.selenium/trunk/zope2.cfg
===================================================================
--- gocept.selenium/trunk/zope2.cfg	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/zope2.cfg	2010-12-26 15:47:09 UTC (rev 119135)
@@ -17,7 +17,6 @@
 zope2-location = ${zope2:location}
 user = admin:admin
 eggs = ${buildout:package}
-zcml = gocept.selenium.tests.fixture
 
 [zope2]
 recipe = plone.recipe.zope2install

Modified: gocept.selenium/trunk/zope212.cfg
===================================================================
--- gocept.selenium/trunk/zope212.cfg	2010-12-26 14:36:24 UTC (rev 119134)
+++ gocept.selenium/trunk/zope212.cfg	2010-12-26 15:47:09 UTC (rev 119135)
@@ -15,4 +15,3 @@
 recipe = plone.recipe.zope2instance
 user = admin:admin
 eggs = ${buildout:package}
-zcml = gocept.selenium.tests.fixture



More information about the checkins mailing list