[Checkins] SVN: gocept.selenium/trunk/ refactor package structure of plone.testing support

Godefroid Chapelle gotcha at bubblenet.be
Tue Dec 21 15:01:04 EST 2010


Log message for revision 119038:
  refactor package structure of plone.testing support
  
  to avoid Testing.ZopeTestCase imports which break plone.testing
  

Changed:
  U   gocept.selenium/trunk/plonetesting-plone3.cfg
  U   gocept.selenium/trunk/plonetesting-plone4.cfg
  D   gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting3/
  D   gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting4/
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/__init__.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/isolation_layer.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/
  D   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/
  U   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/testing.zcml
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/
  A   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py
  D   gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope212.py
  D   gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py
  D   gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py
  D   gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/

-=-
Modified: gocept.selenium/trunk/plonetesting-plone3.cfg
===================================================================
--- gocept.selenium/trunk/plonetesting-plone3.cfg	2010-12-21 19:30:54 UTC (rev 119037)
+++ gocept.selenium/trunk/plonetesting-plone3.cfg	2010-12-21 20:01:04 UTC (rev 119038)
@@ -29,7 +29,7 @@
 
 [test]
 recipe = zc.recipe.testrunner
-defaults = ["--ignore_dir=ztk", "--ignore_dir=static", "--ignore_dir=plonetesting4", "--tests-pattern=plonetesting"]
+defaults = ["--ignore_dir=zope2", "--tests-pattern=plone3", "--dir=gocept.selenium.plonetesting"]
 extra-paths = ${zope2:location}/lib/python
 eggs = ${instance:eggs}
        plone.app.testing

Modified: gocept.selenium/trunk/plonetesting-plone4.cfg
===================================================================
--- gocept.selenium/trunk/plonetesting-plone4.cfg	2010-12-21 19:30:54 UTC (rev 119037)
+++ gocept.selenium/trunk/plonetesting-plone4.cfg	2010-12-21 20:01:04 UTC (rev 119038)
@@ -19,7 +19,7 @@
 
 [test]
 recipe = zc.recipe.testrunner
-defaults = ["--ignore_dir=ztk", "--ignore_dir=static", "--ignore_dir=plonetesting3", "--tests-pattern=plonetesting"]
+defaults = ["--ignore_dir=zope2", "--tests-pattern=plone4", "--dir=gocept.selenium.plonetesting"]
 eggs = ${instance:eggs}
        plone.app.testing
 

Copied: gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py (from rev 119031, gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py)
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/__init__.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -0,0 +1,30 @@
+import selenium
+
+from plone.testing import Layer
+from plone.testing.z2 import ZSERVER_FIXTURE
+
+import gocept.selenium.selenese
+
+
+class Selenium(Layer):
+
+    defaultBases = (ZSERVER_FIXTURE, )
+
+    _rc_server = 'localhost'
+    _rc_port = 4444
+    _browser = '*firefox'
+
+    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'])
+
+    def tearDown(self):
+        super(Selenium, self).tearDown()
+        self.selenium.stop()
+
+SELENIUM = Selenium()

Copied: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/isolation_layer.py (from rev 119031, gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py)
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/isolation_layer.py	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/isolation_layer.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -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
+
+from gocept.selenium import plonetesting
+
+
+class Isolation(Layer):
+
+    defaultBases = (STARTUP, )
+
+    def setUp(self):
+        context = self['configurationContext']
+        xmlconfig.file('testing.zcml', package=plonetesting.tests,
+            context=context)
+
+ISOLATION = Isolation()
+
+FUNCTIONAL_ISOLATION = FunctionalTesting(bases=(ISOLATION,),
+    name="gocept.selenium:FunctionalIsolation")

Deleted: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting3/test_plone3.py	2010-12-21 15:09:19 UTC (rev 119031)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -1,41 +0,0 @@
-#############################################################################
-#
-# Copyright (c) 2009 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 unittest
-import gocept.selenium.zope2
-from gocept.selenium.zope2.plonetesting import ISOLATION
-import gocept.selenium.tests.isolation
-
-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
-
-
-class Plone3Tests(gocept.selenium.tests.isolation.IsolationTests,
-                 gocept.selenium.plone.TestCase):
-
-    layer = gocept.selenium.zope2.Layer(PLONE_FIXTURE, ISOLATION)
-
-    def test_plone_login(self):
-        sel = self.selenium
-        sel.open('/plone')
-        sel.type('name=__ac_name', SITE_OWNER_NAME)
-        sel.type('name=__ac_password', SITE_OWNER_PASSWORD)
-        sel.click('name=submit')
-        sel.waitForPageToLoad()
-        sel.assertTextPresent('Welcome! You are now logged in.')
-
-
-def test_suite():
-    return unittest.makeSuite(Plone3Tests)

Copied: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py (from rev 119033, gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting3/test_plone3.py)
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone3/test_plone3.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -0,0 +1,62 @@
+#############################################################################
+#
+# Copyright (c) 2009 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 unittest
+
+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.tests.isolation
+from gocept.selenium import plonetesting
+from gocept.selenium.plonetesting.tests import isolation_layer
+from gocept.selenium.plonetesting.tests.zope2.test_zope2 import Zope2Tests
+
+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:Plone3")
+
+
+class Plone3Tests(unittest.TestCase,
+    gocept.selenium.tests.isolation.IsolationTests):
+
+    layer = PLONE_SELENIUM
+
+    @property
+    def selenium(self):
+        # property needed to reuse IsolationTests without touching them
+        # should not be needed in usual tests; see hereunder
+        return self.layer['selenese']
+
+    def test_plone_login(self):
+        sel = self.selenium
+        sel.open('/plone')
+        sel.type('name=__ac_name', SITE_OWNER_NAME)
+        sel.type('name=__ac_password', SITE_OWNER_PASSWORD)
+        sel.click('name=submit')
+        sel.waitForPageToLoad()
+        sel.assertTextPresent('Welcome! You are now logged in.')
+
+
+def test_suite():
+    suite = unittest.makeSuite(Plone3Tests)
+    suite.addTest(unittest.makeSuite(Zope2Tests))
+    return suite

Modified: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plone/tests/plonetesting4/test_plone4.py	2010-12-21 15:09:19 UTC (rev 119031)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/plone4/test_plone4.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -23,8 +23,9 @@
 
 import gocept.selenium.zope2
 import gocept.selenium.tests.isolation
-from gocept.selenium.zope2 import plonetesting
-from gocept.selenium.tests import isolation_layer
+from gocept.selenium import plonetesting
+from gocept.selenium.plonetesting.tests import isolation_layer
+from gocept.selenium.plonetesting.tests.zope2.test_zope2 import Zope2Tests
 
 PLONE_ISOLATION = FunctionalTesting(
     bases=(isolation_layer.ISOLATION, PLONE_FIXTURE),
@@ -59,4 +60,6 @@
 
 
 def test_suite():
-    return unittest.makeSuite(Plone4Tests)
+    suite = unittest.makeSuite(Plone4Tests)
+    suite.addTest(unittest.makeSuite(Zope2Tests))
+    return suite

Copied: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/testing.zcml (from rev 119031, gocept.selenium/trunk/src/gocept/selenium/zope2/testing.zcml)
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/testing.zcml	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/testing.zcml	2010-12-21 20:01:04 UTC (rev 119038)
@@ -0,0 +1,7 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope">
+
+  <include package="Products.Five" />
+  <include package="gocept.selenium.tests.fixture" />
+
+</configure>

Copied: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py (from rev 119031, gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/test_zope212.py)
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py	                        (rev 0)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope2.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -0,0 +1,40 @@
+#############################################################################
+#
+# Copyright (c) 2009 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 unittest
+
+import plone.testing
+from gocept.selenium import plonetesting
+import gocept.selenium.tests.isolation
+from gocept.selenium.plonetesting.tests import isolation_layer
+
+
+ZOPE2_ISOLATION = plone.testing.Layer(
+    bases=(plonetesting.SELENIUM, isolation_layer.FUNCTIONAL_ISOLATION,),
+    name="gocept.selenium:Zope2")
+
+
+class Zope2Tests(unittest.TestCase,
+    gocept.selenium.tests.isolation.IsolationTests):
+
+    layer = ZOPE2_ISOLATION
+
+    @property
+    def selenium(self):
+        # property needed to reuse IsolationTests without touching them
+        # should not be needed in usual tests; see plone4 tests for example
+        return self.layer['selenese']
+
+
+def test_suite():
+    return unittest.makeSuite(Zope2Tests)

Deleted: gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope212.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/tests/plonetesting/test_zope212.py	2010-12-21 15:09:19 UTC (rev 119031)
+++ gocept.selenium/trunk/src/gocept/selenium/plonetesting/tests/zope2/test_zope212.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -1,40 +0,0 @@
-#############################################################################
-#
-# Copyright (c) 2009 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 unittest
-
-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(unittest.TestCase,
-    gocept.selenium.tests.isolation.IsolationTests):
-
-    layer = ZOPE2_ISOLATION
-
-    @property
-    def selenium(self):
-        # property needed to reuse IsolationTests without touching them
-        # should not be needed in usual tests; see plone4 tests for example
-        return self.layer['selenese']
-
-
-def test_suite():
-    return unittest.makeSuite(Zope212Tests)

Deleted: gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py	2010-12-21 19:30:54 UTC (rev 119037)
+++ gocept.selenium/trunk/src/gocept/selenium/tests/isolation_layer.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -1,22 +0,0 @@
-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")

Deleted: gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py	2010-12-21 19:30:54 UTC (rev 119037)
+++ gocept.selenium/trunk/src/gocept/selenium/zope2/plonetesting.py	2010-12-21 20:01:04 UTC (rev 119038)
@@ -1,30 +0,0 @@
-import selenium
-
-from plone.testing import Layer
-from plone.testing.z2 import ZSERVER_FIXTURE
-
-import gocept.selenium.selenese
-
-
-class Selenium(Layer):
-
-    defaultBases = (ZSERVER_FIXTURE, )
-
-    _rc_server = 'localhost'
-    _rc_port = 4444
-    _browser = '*firefox'
-
-    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'])
-
-    def tearDown(self):
-        super(Selenium, self).tearDown()
-        self.selenium.stop()
-
-SELENIUM = Selenium()



More information about the checkins mailing list