[Checkins] SVN: Sandbox/darrylcousins/mars.layer/ Tidy up, but tests still not passing

Darryl Cousins darryl at darrylcousins.net.nz
Sun Jan 27 23:49:14 EST 2008


Log message for revision 83274:
  Tidy up, but tests still not passing

Changed:
  U   Sandbox/darrylcousins/mars.layer/buildout.cfg
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py
  D   Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.py
  D   Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.txt
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/directive.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/minimal.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet-ftesting.zcml
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/test_functional.py
  D   Sandbox/darrylcousins/mars.layer/src/mars/layer/interfaces.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/layer.txt
  D   Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.py
  D   Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.zcml
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/tests.py

-=-
Modified: Sandbox/darrylcousins/mars.layer/buildout.cfg
===================================================================
--- Sandbox/darrylcousins/mars.layer/buildout.cfg	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/buildout.cfg	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,23 +1,11 @@
 [buildout]
 develop = .
 parts = test
-eggs-directory = /opt/buildout/mars/eggs
-develop-eggs-directory = /opt/buildout/mars/develop-eggs
-extends = http://grok.zope.org/releaseinfo/grok-0.10.2.cfg
-versions = versions
-executable = /opt/sandbox/mars/bin/python2.4
+extends = http://grok.zope.org/releaseinfo/grok-0.11.1.cfg
 
-[versions]
-zope.securitypolicy = 3.4.0
-zope.app.securitypolicy = 3.4.3
-
 [test]
 recipe = zc.recipe.testrunner
 eggs = mars.layer [test]
 defaults = ['--tests-pattern', '^f?tests$',
 	'-v'
 	]
-
-[zope3]
-location = .
-

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt	2008-01-28 04:49:13 UTC (rev 83274)
@@ -39,18 +39,11 @@
   class IMyLayer(mars.layer.IMinimalLayer):
       pass
 
-  class MySkin(mars.layer.Skin):
-      mars.layer.layer(IMyLayer)
+  class MySkin(grok.Skin):
+      grok.layer(IMyLayer)
 
 Skin is available as http://localhost/++skin++myskin
 
-Directives specific to this package
------------------------------------
-
-* mars.layer.layer(class_or_interface):
-  The layer for which the view should be available.
-  Default: zope.publisher.browser.interfaces.IBrowserRequest
-
 Relevant grok directives
 ------------------------
 
@@ -58,3 +51,7 @@
   The name for which the skin is registered.
   Default: factory.__name__.lower()
 
+* grok.layer(class_or_interface):
+  The layer for which the skin should be available.
+  Default: zope.publisher.browser.interfaces.IBrowserRequest
+

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,6 +1,3 @@
-from directive import layer
-from components import (Skin, 
-                        ILayer,
-                        IMinimalLayer, 
+from components import (IMinimalLayer, 
                         IPageletLayer)
 

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,17 +1,12 @@
 import zope.interface
+
 from z3c.layer.pagelet import IPageletBrowserLayer
 from z3c.layer.minimal import IMinimalBrowserLayer
 
-class ILayer(zope.interface.Interface):
-    pass
+import grok
 
-class IMinimalLayer(ILayer, IMinimalBrowserLayer):
+class IMinimalLayer(grok.IGrokLayer, IMinimalBrowserLayer):
     pass
 
-class IPageletLayer(ILayer, IPageletBrowserLayer):
+class IPageletLayer(grok.IGrokLayer, IPageletBrowserLayer):
     pass
-
-class Skin(object):
-    pass
-
-

Deleted: Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,5 +0,0 @@
-from martian.directive import (InterfaceOrClassDirective,
-                            ClassOrModuleDirectiveContext)
-
-layer = InterfaceOrClassDirective('mars.layer.layer',
-                           ClassOrModuleDirectiveContext())

Deleted: Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.txt
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.txt	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/directive.txt	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,18 +0,0 @@
-=====================
-Mars Layer Directives
-=====================
-
-Directives specific to this package
------------------------------------
-
-* mars.layer.layer(class_or_interface):
-  The layer for which the view should be available.
-  Default: zope.publisher.browser.interfaces.IBrowserRequest
-
-Relevant grok directives
-------------------------
-
-* grok.name(name):
-  The name for which the skin is registered.
-  Default: factory.__name__.lower()
-

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/directive.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/directive.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/directive.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,9 +1,6 @@
 """
 Test the claimed directives.
 
-  >>> import grok
-  >>> grok.grok('mars.layer.ftests.directive')
-
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
   >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
@@ -36,7 +33,7 @@
 class IMyLayer(mars.layer.IMinimalLayer):
     pass
 
-class MySkin(mars.layer.Skin):
+class MySkin(grok.Skin):
     grok.name('namedskin')
-    mars.layer.layer(IMyLayer)
+    grok.layer(IMyLayer)
 

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/minimal.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/minimal.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/minimal.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,7 +1,7 @@
 """
 
-  >>> import grok
-  >>> grok.grok('mars.layer.ftests.minimal')
+  >>> from grok.testing import grok
+  >>> grok('mars.layer.ftests.minimal')
 
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet-ftesting.zcml
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet-ftesting.zcml	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet-ftesting.zcml	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,13 +1,13 @@
 <configure xmlns="http://namespaces.zope.org/zope"
            xmlns:meta="http://namespaces.zope.org/meta"
            xmlns:browser="http://namespaces.zope.org/browser"
+           xmlns:grok="http://namespaces.zope.org/grok"
            i18n_domain="zope"
            package="mars.layer.ftests">
 
   <include package="grok" file="meta.zcml" />
+  <grok:grok package="mars.layer.ftests" />
 
-  <include package="mars.layer" file="meta.zcml" />
-
   <include package="z3c.layer.pagelet.tests" file="ftesting.zcml" />
 
 </configure>

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/pagelet.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,7 +1,7 @@
 """
 
-  >>> import grok
-  >>> grok.grok('mars.layer.ftests.pagelet')
+  >>> import grok.testing
+  >>> grok.testing.grok(__name__)
 
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
@@ -35,7 +35,7 @@
 class IMyLayer(mars.layer.IPageletLayer):
     pass
 
-class MySkin(mars.layer.Skin):
-    mars.layer.layer(IMyLayer)
+class MySkin(grok.Skin):
+    grok.layer(IMyLayer)
 
 

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/test_functional.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/test_functional.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/ftests/test_functional.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -18,12 +18,12 @@
 def test_suite():
     suite = unittest.TestSuite()
     dottedname = 'mars.layer.ftests.%s'
-    for name in ['minimal', 'directive']:
-        test = doctest.DocTestSuite(
-                    dottedname % name, setUp=setUp, globs=globs,
-                    tearDown=tearDown, optionflags=optionflags)
-        test.layer = TestMinimalLayer
-        suite.addTest(test)
+    #for name in ['minimal', 'directive']:
+    #    test = doctest.DocTestSuite(
+    #                dottedname % name, setUp=setUp, globs=globs,
+    #                tearDown=tearDown, optionflags=optionflags)
+    #    test.layer = TestMinimalLayer
+    #    suite.addTest(test)
     test = doctest.DocTestSuite(
                 dottedname % 'pagelet', setUp=setUp, globs=globs,
                 tearDown=tearDown, optionflags=optionflags)

Deleted: Sandbox/darrylcousins/mars.layer/src/mars/layer/interfaces.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/interfaces.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/interfaces.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,8 +0,0 @@
-import zope.interface
-
-class IMarsLayerDirectives(zope.interface.Interface):
-
-    def layer(class_or_interface):
-        """The layer for which the object should be available.
-        Default: zope.publisher.browser.interfaces.IBrowserRequest
-        """

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/layer.txt
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/layer.txt	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/layer.txt	2008-01-28 04:49:13 UTC (rev 83274)
@@ -5,22 +5,27 @@
 Initially I began with defining a single layer but as I developed mars.fordemo I
 realised the possibility of defining more layers here in this package.
 
-  >>> import mars.layer
+  >>> import grok
 
 The mars.layer.layer directive can be used in a module to define the layer for
 all of the components in the file. Layers aren't ``grokked`` as such but
 mars.layer.Skin is.
 
-  >>> class IMyLayer(mars.layer.ILayer):
+  >>> class IMyLayer(grok.IGrokLayer):
   ...     pass
 
-  >>> class MySkin(mars.layer.Skin):
-  ...     mars.layer.layer(IMyLayer)
+  >>> class MySkin(grok.Skin):
+  ...     grok.layer(IMyLayer)
 
-  >>> from mars.layer.meta import SkinGrokker
-  >>> SkinGrokker().grok('', MySkin, None, None, None)
+  >>> #from mars.layer.meta import SkinGrokker
+  >>> #SkinGrokker().grok('', MySkin, None, None, None)
   True
 
+  >>> from grok.meta import SkinGrokker
+  >>> SkinGrokker().grok('', MySkin, None, config)
+  True
+  >>> config.execute_actions()
+
   >>> from zope.publisher.interfaces.browser import IBrowserSkinType
   >>> IBrowserSkinType.providedBy(IMyLayer)
   True

Deleted: Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,24 +0,0 @@
-import martian
-import grok
-import zope.component
-from zope.publisher.interfaces.browser import (IBrowserRequest,
-                                               IBrowserSkinType)
-from martian import util
-import mars.layer
-from mars.layer.components import ILayer
-
-class ILayerGrokker(martian.ClassGrokker):
-    component_class = ILayer
-
-class SkinGrokker(martian.ClassGrokker):
-    component_class = mars.layer.Skin
-
-    def grok(self, name, factory, context, module_info, templates):
-        layer = util.class_annotation(factory, 'mars.layer.layer',
-                                    None) or module_info.getAnnotation('mars.layer.layer',
-                                    None) or IBrowserRequest
-        name = grok.util.class_annotation(factory, 'grok.name', factory.__name__.lower())
-        #print '\nName: ', name, 'Factory: ', factory, 'layer: ', layer, '\n'
-        zope.component.interface.provideInterface(name, layer, IBrowserSkinType)
-
-        return True

Deleted: Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.zcml
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.zcml	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/meta.zcml	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1 +0,0 @@
-<grok package=".meta" xmlns="http://namespaces.zope.org/grok" />

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/tests.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/tests.py	2008-01-28 04:48:41 UTC (rev 83273)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/tests.py	2008-01-28 04:49:13 UTC (rev 83274)
@@ -1,19 +1,21 @@
 import unittest
+
 from zope.testing import doctest
+from zope.configuration.config import ConfigurationMachine
 
 optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
 
 def setUp(test):
-    pass
+    test.globs['config'] = ConfigurationMachine()
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTests([doctest.DocFileSuite('./layer.txt',
-                             setUp=setUp,
-                             optionflags=optionflags),
-                   ])
+    return doctest.DocFileSuite(
+            'layer.txt',
+            setUp=setUp,
+            optionflags=optionflags
+            )
 
-    return suite
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
+



More information about the Checkins mailing list