[Checkins] SVN: grok/trunk/src/grok/ on test setup register an template ignore pattern as it is cleared on teardown resulting in annoying output during the tests

Jan Wijbrand Kolman cvs-admin at zope.org
Mon Apr 30 08:09:08 UTC 2012


Log message for revision 125424:
  on test setup register an template ignore pattern as it is cleared on teardown resulting in annoying output during the tests

Changed:
  U   grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py
  U   grok/trunk/src/grok/ftests/lifecycle/create_application.py
  U   grok/trunk/src/grok/tests/adapter/importedmodel.py
  U   grok/trunk/src/grok/tests/test_grok.py

-=-
Modified: grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py	2012-04-30 08:07:10 UTC (rev 125423)
+++ grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py	2012-04-30 08:09:05 UTC (rev 125424)
@@ -9,7 +9,7 @@
   >>> getRootFolder()['herd'] = herd
   Traceback (most recent call last):
     ...
-  GrokError: grok.Indexes in <module
+  GrokError: grokcore.catalog.Indexes in <module
   'grok.ftests.catalog.indexes_nonexistent' from ...>
   refers to an attribute or method 'foo' on interface <InterfaceClass
   grok.ftests.catalog.indexes_nonexistent.IMammoth>, but this does not
@@ -58,4 +58,4 @@
     foo = index.Field()
 
 
-    
+

Modified: grok/trunk/src/grok/ftests/lifecycle/create_application.py
===================================================================
--- grok/trunk/src/grok/ftests/lifecycle/create_application.py	2012-04-30 08:07:10 UTC (rev 125423)
+++ grok/trunk/src/grok/ftests/lifecycle/create_application.py	2012-04-30 08:09:05 UTC (rev 125424)
@@ -18,7 +18,7 @@
   >>> app = grok.util.create_application(Cave, root, 'mycave')
   Cave <zope.lifecycleevent.ObjectCreatedEvent object at ...>
   Cave <zope.lifecycleevent.ObjectAddedEvent object at ...>
-  Cave <grok.events.ApplicationInitializedEvent object at ...>
+  Cave <grokcore.site.interfaces.ApplicationInitializedEvent object at ...>
 
 As we can see, the events are effectively trigged, and in the right
 order. The function returns the persisted application.

Modified: grok/trunk/src/grok/tests/adapter/importedmodel.py
===================================================================
--- grok/trunk/src/grok/tests/adapter/importedmodel.py	2012-04-30 08:07:10 UTC (rev 125423)
+++ grok/trunk/src/grok/tests/adapter/importedmodel.py	2012-04-30 08:09:05 UTC (rev 125424)
@@ -2,8 +2,9 @@
 Imported model and adapter won't be grokked:
 
   >>> import grok
+  >>> from grok.tests.adapter.adapter import IHome
+
   >>> grok.testing.grok(__name__)
-  >>> from grok.tests.adapter.adapter import IHome
   >>> cave = Cave()
   >>> home = IHome(cave)
   Traceback (most recent call last):

Modified: grok/trunk/src/grok/tests/test_grok.py
===================================================================
--- grok/trunk/src/grok/tests/test_grok.py	2012-04-30 08:07:10 UTC (rev 125423)
+++ grok/trunk/src/grok/tests/test_grok.py	2012-04-30 08:09:05 UTC (rev 125424)
@@ -1,16 +1,24 @@
 import re
 import unittest
 import doctest
+import zope.component.eventtesting
+import zope.component.testlayer
+import grok
+
 from pkg_resources import resource_listdir
 from zope.testing import cleanup, renormalizing
-import zope.component.eventtesting
+from grokcore.view.templatereg import file_template_registry
 
-def setUpZope(test):
-    zope.component.eventtesting.setUp(test)
+class GrokTestLayer(zope.component.testlayer.ZCMLFileLayer):
+    def testSetUp(self):
+        zope.component.eventtesting.setUp()
+        file_template_registry.ignore_templates('^\.')
 
-def cleanUpZope(test):
-    cleanup.cleanUp()
+    def testTearDown(self):
+        cleanup.cleanUp()
 
+layer = GrokTestLayer(grok, zcml_file='configure.zcml')
+
 checker = renormalizing.RENormalizing([
     # str(Exception) has changed from Python 2.4 to 2.5 (due to
     # Exception now being a new-style class).  This changes the way
@@ -29,25 +37,35 @@
             continue
         if filename == '__init__.py':
             continue
-
         dottedname = 'grok.tests.%s.%s' % (name, filename[:-3])
-        test = doctest.DocTestSuite(dottedname,
-                                    setUp=setUpZope,
-                                    tearDown=cleanUpZope,
-                                    checker=checker,
-                                    optionflags=doctest.ELLIPSIS+
-                                    doctest.NORMALIZE_WHITESPACE)
-
+        test = doctest.DocTestSuite(
+            dottedname,
+            checker=checker,
+            optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE)
+        test.layer = layer
         suite.addTest(test)
     return suite
 
 def test_suite():
     suite = unittest.TestSuite()
-    for name in ['adapter', 'error', 'event', 'security', 'catalog',
-                 'zcml', 'utility', 'xmlrpc', 'container', 'viewlet',
-                 'traversal', 'grokker', 'directive',
-                 'baseclass', 'application',
-                 'conflict']:
+    for name in [
+        'adapter',
+        'application',
+        'baseclass',
+        'catalog',
+        'conflict',
+        'container',
+        'directive',
+        'error',
+        'event',
+        'grokker',
+        'security',
+        'traversal',
+        'utility',
+        'viewlet',
+        'xmlrpc',
+        'zcml',
+        ]:
         suite.addTest(suiteFromPackage(name))
     return suite
 



More information about the checkins mailing list