[Checkins] SVN: grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective Test the skin directive implementation itself.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jul 28 16:02:10 EDT 2008


Log message for revision 88891:
  Test the skin directive implementation itself.

Changed:
  U   grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py
  U   grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective_fixture.py
  U   grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirectiveonaclass_fixture.py

-=-
Modified: grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py
===================================================================
--- grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py	2008-07-28 19:54:27 UTC (rev 88890)
+++ grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py	2008-07-28 20:02:09 UTC (rev 88891)
@@ -1,8 +1,28 @@
 """
+The skin directive is used to trigger the registration of a layer as a
+IBrowserSkin type. Since layers are really interface classes, we need a special
+directive implementation that will take care of storing data on the interface.
+
+Import - and thus "execute" the skindirective fixture to make the directive
+have effect::
+
+   >>> from grok.tests.directive import skindirective_fixture
+
    >>> import grok
-   >>> import grok.tests.directive.directiveoninterface_fixture
+   >>> print grok.skin.bind().get(skindirective_fixture.IIsAnInterface)
+   skin_name
 
-   >>> from grok.tests.directive.directiveoninterface_fixture import IIsInterface
-   >>> print grok.skin.bind().get(IIsInterface)
-   skin name
+Unfortunately it is not possible to check whether the directive isn't used on a
+"normal" class instead of an interface class. This means, the directive can be
+*declared* on a normal class, however, using it to retrieve data will fail due
+to the way the directive's store is implemented::
+
+   >>> from grok.tests.directive import skindirectiveonaclass_fixture
+
+   >>> print grok.skin.bind().get(
+   ...     skindirectiveonaclass_fixture.NotAnInterfaceClass)
+   Traceback (most recent call last):
+   ...
+   AttributeError: type object 'NotAnInterfaceClass' has no attribute
+   'queryTaggedValue'
 """

Modified: grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective_fixture.py
===================================================================
--- grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective_fixture.py	2008-07-28 19:54:27 UTC (rev 88890)
+++ grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective_fixture.py	2008-07-28 20:02:09 UTC (rev 88891)
@@ -1,5 +1,5 @@
 import grok
 from zope import interface
 
-class IIsInterface(interface.Interface):
-    grok.skin('skin name')
+class IIsAnInterface(interface.Interface):
+    grok.skin('skin_name')

Modified: grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirectiveonaclass_fixture.py
===================================================================
--- grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirectiveonaclass_fixture.py	2008-07-28 19:54:27 UTC (rev 88890)
+++ grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirectiveonaclass_fixture.py	2008-07-28 20:02:09 UTC (rev 88891)
@@ -1,5 +1,4 @@
 import grok
-from zope import interface
 
-class IIsInterface(interface.Interface):
-    grok.skin('skin name')
+class NotAnInterfaceClass(object):
+    grok.skin('failing_directive')



More information about the Checkins mailing list