[Checkins] SVN: grok/trunk/src/grok/test no need to load the configure.zcml in the test layer, but do make sure a minimal set of grokkers have been loaded

Jan Wijbrand Kolman cvs-admin at zope.org
Tue May 1 08:38:37 UTC 2012


Log message for revision 125453:
  no need to load the configure.zcml in the test layer, but do make sure a minimal set of grokkers have been loaded

Changed:
  U   grok/trunk/src/grok/testing.py
  U   grok/trunk/src/grok/tests/test_grok.py

-=-
Modified: grok/trunk/src/grok/testing.py
===================================================================
--- grok/trunk/src/grok/testing.py	2012-05-01 08:37:17 UTC (rev 125452)
+++ grok/trunk/src/grok/testing.py	2012-05-01 08:38:33 UTC (rev 125453)
@@ -20,7 +20,7 @@
 from grokcore.component.testing import grok_component
 
 
-def grok(module_name):
+def grok(module_name=None):
     """Grok a module.
 
     Test helper to 'grok' a module named by `module_name`, a dotted
@@ -43,7 +43,8 @@
     zcml.do_grok('grokcore.traverser.meta', config)
     zcml.do_grok('grokcore.rest.meta', config)
     zcml.do_grok('grokcore.xmlrpc.meta', config)
-    zcml.do_grok(module_name, config)
+    if module_name is not None:
+        zcml.do_grok(module_name, config)
     config.execute_actions()
 
 

Modified: grok/trunk/src/grok/tests/test_grok.py
===================================================================
--- grok/trunk/src/grok/tests/test_grok.py	2012-05-01 08:37:17 UTC (rev 125452)
+++ grok/trunk/src/grok/tests/test_grok.py	2012-05-01 08:38:33 UTC (rev 125453)
@@ -4,20 +4,22 @@
 import zope.component.eventtesting
 import zope.component.testlayer
 import grok
+import grok.testing
 
 from pkg_resources import resource_listdir
 from zope.testing import cleanup, renormalizing
 from grokcore.view.templatereg import file_template_registry
 
-class GrokTestLayer(zope.component.testlayer.ZCMLFileLayer):
+class GrokTestLayer(zope.component.testlayer.LayerBase):
     def testSetUp(self):
+        grok.testing.grok()
         zope.component.eventtesting.setUp()
         file_template_registry.ignore_templates('^\.')
 
     def testTearDown(self):
         cleanup.cleanUp()
 
-layer = GrokTestLayer(grok, zcml_file='configure.zcml')
+layer = GrokTestLayer(grok, name='grok.tests.layer')
 
 checker = renormalizing.RENormalizing([
     # str(Exception) has changed from Python 2.4 to 2.5 (due to



More information about the checkins mailing list