[Checkins] SVN: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ Working up tests

Darryl Cousins darryl at darrylcousins.net.nz
Tue Jul 17 07:56:01 EDT 2007


Log message for revision 78067:
  Working up tests

Changed:
  U   Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/contentprovider.txt
  U   Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/tests.py

-=-
Modified: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/contentprovider.txt
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/contentprovider.txt	2007-07-17 11:55:34 UTC (rev 78066)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/contentprovider.txt	2007-07-17 11:56:01 UTC (rev 78067)
@@ -31,17 +31,6 @@
   >>> import os, tempfile
   >>> temp_dir = tempfile.mkdtemp()
 
-We need also to set up a fake module_ info class to pass to the content provider
-grokker.
-
-  >>> from martian.interfaces import IModuleInfo
-  >>> class ModuleInfo(object):
-  ...     zope.interface.implements(IModuleInfo)
-  ...     path = ''
-  ...     package_dotted_name = ''
-  ...     def getAnnotation(self, name, default):
-  ...         return default
-
 Define the content provider
 ---------------------------
 
@@ -59,7 +48,7 @@
 
   >>> from mars.contentprovider.meta import ContentProviderGrokker
   >>> ContentProviderGrokker().grok('title', Title, zope.interface.Interface,
-  ...                               ModuleInfo(), None)
+  ...                               module_info, None)
   True
 
 Testing the content provider
@@ -119,11 +108,11 @@
 As before we need to manually ``grok`` the classes.
 
   >>> from mars.view.meta import LayoutViewGrokker
-  >>> LayoutViewGrokker().grok('', View, None, ModuleInfo(), None)
+  >>> LayoutViewGrokker().grok('', View, None, module_info, None)
   True
 
   >>> from mars.template.meta import LayoutFactoryGrokker
-  >>> LayoutFactoryGrokker().grok('', ViewTemplate, None, ModuleInfo(), None)
+  >>> LayoutFactoryGrokker().grok('', ViewTemplate, None, module_info, None)
   True
 
 Now we can look up the view.

Modified: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/tests.py
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/tests.py	2007-07-17 11:55:34 UTC (rev 78066)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/tests.py	2007-07-17 11:56:01 UTC (rev 78067)
@@ -1,6 +1,20 @@
 import unittest
 from zope.testing import doctest
 
+import zope.interface
+
+from martian.interfaces import IModuleInfo
+
+class ModuleInfo(object):
+    zope.interface.implements(IModuleInfo)
+    path = ''
+    package_dotted_name = ''
+
+    def getAnnotation(self, name, default):
+        return default
+
+globs = dict(module_info=ModuleInfo())
+
 optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
 
 def setUp(test):



More information about the Checkins mailing list