[Checkins] SVN: plone.z3cform/trunk/ Use plone.testing for functional test layer support.

Hano Schlichting cvs-admin at zope.org
Sat May 19 21:03:43 UTC 2012


Log message for revision 126396:
  Use plone.testing for functional test layer support.
  

Changed:
  U   plone.z3cform/trunk/docs/HISTORY.txt
  U   plone.z3cform/trunk/plone/z3cform/tests.py
  U   plone.z3cform/trunk/setup.py

-=-
Modified: plone.z3cform/trunk/docs/HISTORY.txt
===================================================================
--- plone.z3cform/trunk/docs/HISTORY.txt	2012-05-19 20:46:27 UTC (rev 126395)
+++ plone.z3cform/trunk/docs/HISTORY.txt	2012-05-19 21:03:39 UTC (rev 126396)
@@ -4,6 +4,9 @@
 0.8 - unreleased
 ----------------
 
+* Use plone.testing for functional test layer support.
+  [hannosch]
+
 * Use ViewPageTemplateFile from zope.browserpage.
   [hannosch]
 

Modified: plone.z3cform/trunk/plone/z3cform/tests.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/tests.py	2012-05-19 20:46:27 UTC (rev 126395)
+++ plone.z3cform/trunk/plone/z3cform/tests.py	2012-05-19 21:03:39 UTC (rev 126396)
@@ -1,21 +1,20 @@
-import os
 import doctest
 import unittest
 
+from plone.testing import Layer, z2, zca
+from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from zope import component
 from zope import interface
 from zope.component import testing
-from zope.app.testing.functional import ZCMLLayer
 import zope.traversing.adapters
 import zope.traversing.namespace
 import zope.publisher.interfaces.browser
 import z3c.form.testing
+from zope.configuration import xmlconfig
 
 import plone.z3cform.templates
 
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 
-
 def create_eventlog(event=interface.Interface):
     value = []
 
@@ -60,23 +59,37 @@
         (None, None, None, None, None, None),
         z3c.form.interfaces.IErrorViewSnippet)
 
-testing_zcml_path = os.path.join(os.path.dirname(__file__), 'testing.zcml')
-testing_zcml_layer = ZCMLLayer(
-    testing_zcml_path, 'plone.z3cform', 'testing_zcml_layer')
 
+class P3FLayer(Layer):
+    defaultBases = (z2.STARTUP, )
 
+    def setUp(self):
+        self['configurationContext'] = context = \
+            zca.stackConfigurationContext(self.get('configurationContext'))
+        import plone.z3cform
+        xmlconfig.file('testing.zcml', plone.z3cform, context=context)
+
+    def tearDown(self):
+        del self['configurationContext']
+
+
+P3F_FIXTURE = P3FLayer()
+FUNCTIONAL_TESTING = z2.FunctionalTesting(bases=(P3F_FIXTURE, ),
+    name="plone.z3cform:Functional")
+
+
 def test_suite():
     layout_txt = doctest.DocFileSuite('layout.txt')
-    layout_txt.layer = testing_zcml_layer
+    layout_txt.layer = FUNCTIONAL_TESTING
 
     inputs_txt = doctest.DocFileSuite('inputs.txt')
-    inputs_txt.layer = testing_zcml_layer
+    inputs_txt.layer = FUNCTIONAL_TESTING
 
     fieldsets_txt = doctest.DocFileSuite('fieldsets/README.txt')
-    fieldsets_txt.layer = testing_zcml_layer
+    fieldsets_txt.layer = FUNCTIONAL_TESTING
 
     traversal_txt = doctest.DocFileSuite('traversal.txt')
-    traversal_txt.layer = testing_zcml_layer
+    traversal_txt.layer = FUNCTIONAL_TESTING
 
     return unittest.TestSuite([
         layout_txt, inputs_txt, fieldsets_txt, traversal_txt,

Modified: plone.z3cform/trunk/setup.py
===================================================================
--- plone.z3cform/trunk/setup.py	2012-05-19 20:46:27 UTC (rev 126395)
+++ plone.z3cform/trunk/setup.py	2012-05-19 21:03:39 UTC (rev 126396)
@@ -40,8 +40,8 @@
           'zope.component',
           'collective.monkeypatcher',
       ],
-      extras_require = {
+      extras_require={
         'test': ['lxml',
-                 'zope.app.testing']
+                 'plone.testing']
       }
       )



More information about the checkins mailing list