[Checkins] SVN: grok/trunk/ Merged the rest of 'philikon-ftest-layer-does-fixture-setup' branch:

Philipp von Weitershausen philikon at philikon.de
Wed Aug 29 12:56:28 EDT 2007


Log message for revision 79366:
  Merged the rest of 'philikon-ftest-layer-does-fixture-setup' branch:
  
  To summarize: 
  
  * Removed all the grok.grok() calls in ftests. The fixtures are now being set up
    by ftesting.zcml (which is executed upon layer setup). ftests/static had to be
    renamed to ftests/staticdir so that the static resource directory grokker
    wouldn't complain.
  
  * Moved several ftests to regular tests because they weren't actually depending 
    on the ftesting setup.  Most of them were testing for a grokking error which 
    would make the whole ftesting layer setup fail under the new regime.
  
  * For a while now, ftests have been based on a standard DocTestSuite, which means
    that the docstrings do have access to the global module namespace.  We no longer
    need to explicitly import the stuff.  Removed grok/ftests/README.txt (which
    documented this nolonger-existing problem) and removed the nolonger needed imports.
  
  * Fixed a couple of ftests that were discovered to be dependent on the execution
    order of the other ftests.
  

Changed:
  U   grok/trunk/CHANGES.txt
  U   grok/trunk/src/grok/ftesting.zcml
  D   grok/trunk/src/grok/ftests/README.txt
  U   grok/trunk/src/grok/ftests/admin/apps.py
  U   grok/trunk/src/grok/ftests/admin/objectbrowser.py
  U   grok/trunk/src/grok/ftests/catalog/catalog.py
  U   grok/trunk/src/grok/ftests/catalog/indexes.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_app_interface.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_attribute.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_class.py
  D   grok/trunk/src/grok/ftests/catalog/indexes_module.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_multiple.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_multiple_conflict.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_name.py
  D   grok/trunk/src/grok/ftests/catalog/indexes_no_app.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_set.py
  U   grok/trunk/src/grok/ftests/catalog/indexes_site.py
  U   grok/trunk/src/grok/ftests/catalog/setuporder.py
  U   grok/trunk/src/grok/ftests/form/actions.py
  U   grok/trunk/src/grok/ftests/form/addform.py
  U   grok/trunk/src/grok/ftests/form/addform_applydata.py
  U   grok/trunk/src/grok/ftests/form/addform_catalog.py
  U   grok/trunk/src/grok/ftests/form/editform_applydata.py
  U   grok/trunk/src/grok/ftests/form/editform_applydata_classfields.py
  U   grok/trunk/src/grok/ftests/form/editform_applydata_schema.py
  U   grok/trunk/src/grok/ftests/form/form.py
  U   grok/trunk/src/grok/ftests/form/templateform.py
  U   grok/trunk/src/grok/ftests/form/update.py
  U   grok/trunk/src/grok/ftests/security/grant.py
  U   grok/trunk/src/grok/ftests/security/handle_exception.py
  U   grok/trunk/src/grok/ftests/security/json.py
  U   grok/trunk/src/grok/ftests/security/require.py
  U   grok/trunk/src/grok/ftests/security/roles.py
  U   grok/trunk/src/grok/ftests/security/xmlrpc.py
  D   grok/trunk/src/grok/ftests/static/
  A   grok/trunk/src/grok/ftests/staticdir/
  U   grok/trunk/src/grok/ftests/test_grok_functional.py
  U   grok/trunk/src/grok/ftests/traversal/containertraverse.py
  U   grok/trunk/src/grok/ftests/traversal/containertraverser.py
  U   grok/trunk/src/grok/ftests/traversal/items_before_views.py
  U   grok/trunk/src/grok/ftests/traversal/modeltraverse.py
  U   grok/trunk/src/grok/ftests/traversal/traverser.py
  U   grok/trunk/src/grok/ftests/traversal/traverser_sets_parent.py
  U   grok/trunk/src/grok/ftests/url/application.py
  U   grok/trunk/src/grok/ftests/url/redirect.py
  U   grok/trunk/src/grok/ftests/url/url.py
  U   grok/trunk/src/grok/ftests/url/url_function.py
  U   grok/trunk/src/grok/ftests/utility/local.py
  U   grok/trunk/src/grok/ftests/utility/local_override.py
  D   grok/trunk/src/grok/ftests/utility/multiple_class.py
  D   grok/trunk/src/grok/ftests/utility/multiple_directive.py
  U   grok/trunk/src/grok/ftests/utility/public.py
  D   grok/trunk/src/grok/ftests/utility/publicnoncontainer.py
  U   grok/trunk/src/grok/ftests/utility/subclass.py
  U   grok/trunk/src/grok/ftests/view/argument.py
  U   grok/trunk/src/grok/ftests/view/index.py
  U   grok/trunk/src/grok/ftests/view/macros.py
  U   grok/trunk/src/grok/ftests/view/view.py
  U   grok/trunk/src/grok/ftests/xmlrpc/xmlrpc.py
  A   grok/trunk/src/grok/tests/catalog/
  U   grok/trunk/src/grok/tests/test_grok.py
  A   grok/trunk/src/grok/tests/utility/multiple_class.py
  A   grok/trunk/src/grok/tests/utility/multiple_directive.py
  A   grok/trunk/src/grok/tests/utility/publicnoncontainer.py

-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/CHANGES.txt	2007-08-29 16:56:27 UTC (rev 79366)
@@ -20,6 +20,12 @@
   grokkers can depend on components that are set up using regular ZCML
   (e.g. checking for a permission that's defined in ZCML).
 
+* Changed the way grok's functional tests are set up.  Instead of each
+  test case doing its own test setup, it is now done once by the
+  ftesting layer.  This avoids ordering problems when some ftests
+  would influence the environment of other ftests that were run later
+  in time.
+
 0.10 (2007-08-21)
 =================
 

Modified: grok/trunk/src/grok/ftesting.zcml
===================================================================
--- grok/trunk/src/grok/ftesting.zcml	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftesting.zcml	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,10 +1,12 @@
 <configure
    xmlns="http://namespaces.zope.org/zope"
+   xmlns:grok="http://namespaces.zope.org/grok"
    i18n_domain="grok"
    package="grok"
    >
 
   <include package="grok" />
+  <grok:grok package="grok.ftests" />
 
   <securityPolicy
       component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"

Deleted: grok/trunk/src/grok/ftests/README.txt
===================================================================
--- grok/trunk/src/grok/ftests/README.txt	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/README.txt	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,6 +0,0 @@
-Creating functional tests
--------------------------
-
-Unfortunately, functional doctests do not import themselves (as the
-unit-test ones do), so you need to manually import the module in the
-doctest part.

Modified: grok/trunk/src/grok/ftests/admin/apps.py
===================================================================
--- grok/trunk/src/grok/ftests/admin/apps.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/admin/apps.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -13,9 +13,6 @@
 ##############################################################################
 """
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.admin.apps')
-
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
   >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
@@ -41,8 +38,8 @@
 
 We are able to add a mammoth manager...
 
-  >>> browser.getControl('Name your new app:',index=13).value = 'my-mammoth-manager'
-  >>> browser.getControl('Create',index=13).click()
+  >>> browser.getControl('Name your new app:', index=1).value = 'my-mammoth-manager'
+  >>> browser.getControl('Create', index=1).click()
 
   >>> print browser.contents
   <html xmlns="http://www.w3.org/1999/xhtml">

Modified: grok/trunk/src/grok/ftests/admin/objectbrowser.py
===================================================================
--- grok/trunk/src/grok/ftests/admin/objectbrowser.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/admin/objectbrowser.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -13,9 +13,6 @@
 ##############################################################################
 """
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.admin.objectbrowser')
-
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
   >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Modified: grok/trunk/src/grok/ftests/catalog/catalog.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/catalog.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/catalog.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,8 +1,4 @@
 """
-  >>> import grok
-  >>> from grok.ftests.catalog.catalog import Mammoth, Herd
-  >>> grok.grok('grok.ftests.catalog.catalog')
-
 Let's setup a site in which we manage a couple of objects:
 
   >>> herd = Herd()

Modified: grok/trunk/src/grok/ftests/catalog/indexes.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,12 +2,8 @@
 Grok allows you to set up catalog indexes in your application with a
 special indexes declaration.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes import Herd, Herd2, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Modified: grok/trunk/src/grok/ftests/catalog/indexes_app_interface.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_app_interface.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_app_interface.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,12 +3,8 @@
 special indexes declaration. Here we see how we can register indexes for
 an interface instead of an application directly.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_app_interface')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_app_interface import Herd, Herd2, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Modified: grok/trunk/src/grok/ftests/catalog/indexes_attribute.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_attribute.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_attribute.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,12 +4,8 @@
 from the attribute, you can do so, by passing an explicit `attribute`
 keyword argument to the field.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_attribute')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_attribute import Herd, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Modified: grok/trunk/src/grok/ftests/catalog/indexes_class.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_class.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_class.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,12 +3,8 @@
 special indexes declaration. This can also be done without explicit interface.
 The context of the indexes applies to a class in this case.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_class')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_class import Herd, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Deleted: grok/trunk/src/grok/ftests/catalog/indexes_module.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_module.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_module.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,16 +0,0 @@
-"""
-You can create an index on module level, but that should lead to a GrokError:
-
-  >>> import grok
-  >>> from grok.ftests.catalog.indexes_module import func
-  >>> func()
-  Traceback (most recent call last):
-    ...
-  GrokImportError: <class 'grok.index.Field'> can only be instantiated on
-  class level.
-"""
-from grok import index
-
-def func():
-    foo = index.Field()
-    

Modified: grok/trunk/src/grok/ftests/catalog/indexes_multiple.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_multiple.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_multiple.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,12 +3,8 @@
 special indexes declaration. In fact, we have multiple grok.Indexes
 setting up more than one set of indexes in the same catalog.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_multiple')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_multiple import Herd
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Modified: grok/trunk/src/grok/ftests/catalog/indexes_multiple_conflict.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_multiple_conflict.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_multiple_conflict.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,12 +4,8 @@
 setting up more than one set of indexes in the same catalog. What if these
 indexes define the same names?
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_multiple_conflict')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_multiple_conflict import Herd
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   Traceback (most recent call last):

Modified: grok/trunk/src/grok/ftests/catalog/indexes_name.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_name.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_name.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,12 +3,8 @@
 special indexes declaration. We can specify the catalog name using
 grok.name.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_name')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_name import Herd, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Deleted: grok/trunk/src/grok/ftests/catalog/indexes_no_app.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_no_app.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_no_app.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,30 +0,0 @@
-"""
-Grok allows you to set up catalog indexes in your application with a
-special indexes declaration.  We do need to specify a site (such as
-the application) for the Indexes however, otherwise we get a GrokError:
-
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_no_app')
-  Traceback (most recent call last):
-    ...
-  GrokError: No site specified for grok.Indexes subclass in module
-  <module 'grok.ftests.catalog.indexes_no_app' from ...>.
-  Use grok.site() to specify.
-  
-"""
-import grok
-from grok import index
-
-class Herd(grok.Container, grok.Application):
-    pass
-
-class Mammoth(grok.Model):
-    pass
-
-class MammothIndexes(grok.Indexes):
-    grok.context(Mammoth)
-    grok.name('foo_catalog')
-    
-    name = index.Field()
-    age = index.Field()
-    message = index.Text()

Modified: grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,12 +3,8 @@
 special indexes declaration. Here we show what happens if you try
 to set up an index for an attribute that does not exist on the interface.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_nonexistent')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_nonexistent import Herd
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   Traceback (most recent call last):

Modified: grok/trunk/src/grok/ftests/catalog/indexes_set.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_set.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_set.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,12 +1,8 @@
 """
 We now demonstrate the use of a SetIndex with Grok::
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_set')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_set import Herd, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Modified: grok/trunk/src/grok/ftests/catalog/indexes_site.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_site.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/indexes_site.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,12 +3,8 @@
 special indexes declaration. In fact, these indexes can be set up for
 any site::
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.catalog.indexes_site')
-
 Let's set up a site in which we manage a couple of objects::
 
-  >>> from grok.ftests.catalog.indexes_site import Herd
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> from zope.app.component.hooks import setSite

Modified: grok/trunk/src/grok/ftests/catalog/setuporder.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/setuporder.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/catalog/setuporder.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,10 +2,6 @@
 This is similar to catalog.py, except that the site uses a base class
 which also defines a local utility.
 
-  >>> import grok
-  >>> from grok.ftests.catalog.setuporder import Mammoth, Herd
-  >>> grok.grok('grok.ftests.catalog.setuporder')
-
 Let's setup a site in which we manage a couple of objects:
 
   >>> herd = Herd()

Modified: grok/trunk/src/grok/ftests/form/actions.py
===================================================================
--- grok/trunk/src/grok/ftests/form/actions.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/actions.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,9 +4,6 @@
 'Apply' action) is not available anymore, but it can triggered
 manually by calling self.applyData(object, data).
 
-  >>> import grok
-  >>> from grok.ftests.form.actions import Mammoth
-  >>> grok.grok('grok.ftests.form.actions')
   >>> getRootFolder()["manfred"] = Mammoth()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/addform.py
===================================================================
--- grok/trunk/src/grok/ftests/form/addform.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/addform.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,9 +1,6 @@
 """
 We can use grok.AddForm to render an add form for objects:
 
-  >>> import grok
-  >>> from grok.ftests.form.addform import Zoo, Mammoth
-  >>> grok.grok('grok.ftests.form.addform')
   >>> getRootFolder()["zoo"] = Zoo()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/addform_applydata.py
===================================================================
--- grok/trunk/src/grok/ftests/form/addform_applydata.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/addform_applydata.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,9 +3,6 @@
 object.  The object doesn't yet need to have the attributes that are
 going to be set on it.
 
-  >>> import grok
-  >>> from grok.ftests.form.addform_applydata import Zoo, Mammoth
-  >>> grok.grok('grok.ftests.form.addform_applydata')
   >>> getRootFolder()["zoo"] = Zoo()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/addform_catalog.py
===================================================================
--- grok/trunk/src/grok/ftests/form/addform_catalog.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/addform_catalog.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,9 +2,6 @@
 Thanks to Zope's event system, newly added objects are automatically
 catalogued, should a catalog be present.
 
-  >>> import grok
-  >>> from grok.ftests.form.addform_catalog import Zoo, Mammoth
-  >>> grok.grok('grok.ftests.form.addform_catalog')
   >>> getRootFolder()["zoo"] = Zoo()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/editform_applydata.py
===================================================================
--- grok/trunk/src/grok/ftests/form/editform_applydata.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/editform_applydata.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,9 +3,6 @@
 the object.  Update mode means that only those fields are changed on
 the object that need to be changed.
 
-  >>> import grok
-  >>> from grok.ftests.form.editform_applydata import Mammoth
-  >>> grok.grok('grok.ftests.form.editform_applydata')
   >>> getRootFolder()["manfred"] = Mammoth('Manfred the Mammoth', 'Really big')
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/editform_applydata_classfields.py
===================================================================
--- grok/trunk/src/grok/ftests/form/editform_applydata_classfields.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/editform_applydata_classfields.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -6,9 +6,6 @@
 This is essentially the same narrative as 'editform_applydata'. Here
 we test the whole procedure on fields defined on the model class:
 
-  >>> import grok
-  >>> from grok.ftests.form.editform_applydata_classfields import Mammoth
-  >>> grok.grok('grok.ftests.form.editform_applydata_classfields')
   >>> getRootFolder()["manfred"] = mammoth = Mammoth()
   >>> mammoth.name = 'Manfred the Mammoth'
   >>> mammoth.size = 'Really big'

Modified: grok/trunk/src/grok/ftests/form/editform_applydata_schema.py
===================================================================
--- grok/trunk/src/grok/ftests/form/editform_applydata_schema.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/editform_applydata_schema.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -6,9 +6,6 @@
 This is essentially the same narrative as 'editform_applydata'. Here
 we test the whole procedure on fields from schemas:
 
-  >>> import grok
-  >>> from grok.ftests.form.editform_applydata_schema import Mammoth
-  >>> grok.grok('grok.ftests.form.editform_applydata_schema')
   >>> getRootFolder()["manfred"] = Mammoth('Manfred the Mammoth', 'Really big')
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/form.py
===================================================================
--- grok/trunk/src/grok/ftests/form/form.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/form.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,9 +1,6 @@
 """
 A grok.EditForm is a special grok.View that renders an edit form.
 
-  >>> import grok
-  >>> from grok.ftests.form.form import Mammoth
-  >>> grok.grok('grok.ftests.form.form')
   >>> getRootFolder()["manfred"] = Mammoth()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/form/templateform.py
===================================================================
--- grok/trunk/src/grok/ftests/form/templateform.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/templateform.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,10 +2,6 @@
 If a form does not have a template, a simple default template is
 associated with them. Otherwise, the supplied template is used.
 
-  >>> import grok
-  >>> from grok.ftests.form.templateform import Mammoth
-  >>> grok.grok('grok.ftests.form.templateform')
-
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
   >>> from zope import component

Modified: grok/trunk/src/grok/ftests/form/update.py
===================================================================
--- grok/trunk/src/grok/ftests/form/update.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/form/update.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,9 +2,6 @@
 Forms can implement an update() method that will be called before any
 form processing has happened:
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.form.update')
-  >>> from grok.ftests.form.update import Mammoth
   >>> getRootFolder()["manfred"] = Mammoth()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/security/grant.py
===================================================================
--- grok/trunk/src/grok/ftests/security/grant.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/security/grant.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,12 +1,8 @@
 # -*- coding: latin-1 -*-
 """
-We can define a few permissions with grok.Permission:
+We can define a few permissions with grok.Permission and then take a
+look at them in Zope 3's grant view:
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.security.grant')
-
-and then take a look at them in Zope 3's grant view:
-
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
   >>> browser.handleErrors = False

Modified: grok/trunk/src/grok/ftests/security/handle_exception.py
===================================================================
--- grok/trunk/src/grok/ftests/security/handle_exception.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/security/handle_exception.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,8 +4,6 @@
 and cause the grok security to fail, we have a simple test here that assures
 that we don't hit this:
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.security.handle_exception')
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
   >>> browser.open("http://localhost/@@cave")

Modified: grok/trunk/src/grok/ftests/security/json.py
===================================================================
--- grok/trunk/src/grok/ftests/security/json.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/security/json.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,9 +1,6 @@
 """
 Let's test whether require decorators work for json methods.
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.security.json')
-  
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
   >>> browser.handleErrors = False

Modified: grok/trunk/src/grok/ftests/security/require.py
===================================================================
--- grok/trunk/src/grok/ftests/security/require.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/security/require.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,7 +1,4 @@
 """
-  >>> import grok
-  >>> grok.grok('grok.ftests.security.require')
-
 Viewing a protected view with insufficient privileges will yield
 Unauthorized:
 

Modified: grok/trunk/src/grok/ftests/security/roles.py
===================================================================
--- grok/trunk/src/grok/ftests/security/roles.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/security/roles.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,28 +1,31 @@
 """
-  >>> import grok
-  >>> grok.grok('grok.ftests.security.roles')
-
 Viewing a protected view with insufficient privileges will yield
 Unauthorized:
 
   >>> from zope.testbrowser.testing import Browser
   >>> browser = Browser()
+
   >>> browser.open("http://localhost/@@cavepainting")
   Traceback (most recent call last):
   HTTPError: HTTP Error 401: Unauthorized
+
   >>> browser.open("http://localhost/@@editcavepainting")
   Traceback (most recent call last):
   HTTPError: HTTP Error 401: Unauthorized
+
   >>> browser.open("http://localhost/@@erasecavepainting")
   Traceback (most recent call last):
   HTTPError: HTTP Error 401: Unauthorized
 
-When we log in (e.g. as a manager), we can access the views just fine:
+Let's now grant anonymous the PaintingOwner role locally (so that we
+don't have to modify the global setup).  Then we can access the views
+just fine:
 
-  >>> from zope.app.securitypolicy.principalrole import principalRoleManager
-  >>> principalRoleManager.assignRoleToPrincipal(
-  ...    'grok.PaintingOwner', 'zope.mgr')
-  >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+  >>> from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
+  >>> root = getRootFolder()
+  >>> IPrincipalRoleManager(root).assignRoleToPrincipal(
+  ...    'grok.PaintingOwner', 'zope.anybody')
+
   >>> browser.open("http://localhost/@@cavepainting")
   >>> print browser.contents
   What a beautiful painting.
@@ -37,7 +40,7 @@
 
   >>> browser.open("http://localhost/@@approvecavepainting")
   Traceback (most recent call last):
-  HTTPError: HTTP Error 403: Forbidden
+  HTTPError: HTTP Error 401: Unauthorized
 """
 
 import grok

Modified: grok/trunk/src/grok/ftests/security/xmlrpc.py
===================================================================
--- grok/trunk/src/grok/ftests/security/xmlrpc.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/security/xmlrpc.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,9 +1,5 @@
 """
-  >>> import grok
-  >>> grok.grok('grok.ftests.security.xmlrpc')
-
-  >>> from grok.ftests.xmlrpc_helper import ServerProxy
-
+  >>> from zope.app.testing.xmlrpc import ServerProxy
   >>> server = ServerProxy("http://localhost/")
   >>> mgr_server = ServerProxy("http://mgr:mgrpw@localhost/")
 

Copied: grok/trunk/src/grok/ftests/staticdir (from rev 79251, grok/branches/philikon-ftest-layer-does-fixture-setup/src/grok/ftests/staticdir)

Modified: grok/trunk/src/grok/ftests/test_grok_functional.py
===================================================================
--- grok/trunk/src/grok/ftests/test_grok_functional.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/test_grok_functional.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -42,7 +42,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    for name in ['view', 'static', 'xmlrpc', 'traversal', 'form', 'url',
+    for name in ['view', 'staticdir', 'xmlrpc', 'traversal', 'form', 'url',
                  'security', 'utility', 'catalog', 'admin']:
         suite.addTest(suiteFromPackage(name))
     return suite

Modified: grok/trunk/src/grok/ftests/traversal/containertraverse.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/containertraverse.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/traversal/containertraverse.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,9 +3,6 @@
 implementing a 'traverse' method, but the behavior falls back to
 basic container traversal if the 'traverse' method returns None:
 
-  >>> import grok
-  >>> from grok.ftests.traversal.containertraverse import Herd, Mammoth
-  >>> grok.grok('grok.ftests.traversal.containertraverse')
   >>> getRootFolder()["herd"] = herd = Herd()
   >>> herd['manfred'] = Mammoth('Manfred')
   >>> herd['ellie'] = Mammoth('Ellie')

Modified: grok/trunk/src/grok/ftests/traversal/containertraverser.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/containertraverser.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/traversal/containertraverser.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -3,9 +3,6 @@
 The behavior falls back to basic container traversal if the 'traverse'
 method returns None:
 
-  >>> import grok
-  >>> from grok.ftests.traversal.containertraverser import Herd, Mammoth
-  >>> grok.grok('grok.ftests.traversal.containertraverser')
   >>> getRootFolder()["herd"] = herd = Herd()
   >>> herd['manfred'] = Mammoth('Manfred')
   >>> herd['ellie'] = Mammoth('Ellie')

Modified: grok/trunk/src/grok/ftests/traversal/items_before_views.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/items_before_views.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/traversal/items_before_views.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,9 +4,6 @@
 method returns None. Normal behaviour also means that the standard
 Zope 3 paradigm"items before views" is supported in the fallback.
 
-  >>> import grok
-  >>> from grok.ftests.traversal.items_before_views import Herd, Mammoth
-  >>> grok.grok('grok.ftests.traversal.items_before_views')
   >>> getRootFolder()["herd"] = herd = Herd()
   >>> herd['manfred'] = Mammoth('Manfred')
   >>> herd['ellie'] = Mammoth('Ellie')

Modified: grok/trunk/src/grok/ftests/traversal/modeltraverse.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/modeltraverse.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/traversal/modeltraverse.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,9 +2,6 @@
 Models can determine how they want to be traversed by
 implementing a 'traverse' method:
 
-  >>> import grok
-  >>> from grok.ftests.traversal.modeltraverse import Herd
-  >>> grok.grok('grok.ftests.traversal.modeltraverse')
   >>> getRootFolder()["herd"] = Herd('The Big Mammoth Herd')
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/traversal/traverser.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/traverser.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/traversal/traverser.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,9 +2,6 @@
 Apart from using the ``traverse`` method on a model, you can
 also create a separate traverser component:
 
-  >>> import grok
-  >>> from grok.ftests.traversal.traverser import Herd
-  >>> grok.grok('grok.ftests.traversal.traverser')
   >>> getRootFolder()["herd"] = Herd('The Big Mammoth Herd')
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/traversal/traverser_sets_parent.py
===================================================================
--- grok/trunk/src/grok/ftests/traversal/traverser_sets_parent.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/traversal/traverser_sets_parent.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,9 +2,6 @@
 A traverser can set the __parent__ (and __name__) attributes itself,
 in which case Grok's traverser won't interfere:
 
-  >>> import grok
-  >>> from grok.ftests.traversal.traverser_sets_parent import Herd
-  >>> grok.grok('grok.ftests.traversal.traverser_sets_parent')
   >>> getRootFolder()["herd"] = Herd('The Big Mammoth Herd')
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/url/application.py
===================================================================
--- grok/trunk/src/grok/ftests/url/application.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/url/application.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,10 +2,6 @@
 Views have an application_url() method to easily retrieve the url of the
 application::
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.url.application')
-
-  >>> from grok.ftests.url.application import Cave, CaveMan
   >>> getRootFolder()['cave'] = cave = Cave()
   >>> cave['caveman'] = CaveMan()
 

Modified: grok/trunk/src/grok/ftests/url/redirect.py
===================================================================
--- grok/trunk/src/grok/ftests/url/redirect.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/url/redirect.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,10 +1,6 @@
 """
 Views have a redirect() method to easily create redirects:
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.url.redirect')
-
-  >>> from grok.ftests.url.redirect import Mammoth
   >>> getRootFolder()['manfred'] = manfred = Mammoth()
 
 Since the index view redirects to mammoth, we expect to see the URL

Modified: grok/trunk/src/grok/ftests/url/url.py
===================================================================
--- grok/trunk/src/grok/ftests/url/url.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/url/url.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,10 +2,6 @@
 """
 Views have a method that can be used to construct URLs:
 
-  >>> import grok
-  >>> grok.grok('grok.ftests.url.url')
-
-  >>> from grok.ftests.url.url import Herd, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> manfred = Mammoth()

Modified: grok/trunk/src/grok/ftests/url/url_function.py
===================================================================
--- grok/trunk/src/grok/ftests/url/url_function.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/url/url_function.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,10 +4,7 @@
 absolute URL of objects.
 
   >>> from grok import url
-  >>> import grok
-  >>> grok.grok('grok.ftests.url.url_function')
   
-  >>> from grok.ftests.url.url_function import Herd, Mammoth
   >>> herd = Herd()
   >>> getRootFolder()['herd'] = herd
   >>> manfred = Mammoth()

Modified: grok/trunk/src/grok/ftests/utility/local.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/local.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/local.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,15 +2,10 @@
 Local Utilities can be registered on subclasses of grok.Site using
 grok.local_utility:
 
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.local import *
-
-  >>> grok.grok('grok.ftests.utility.local')
-
   >>> cave = Cave()
   >>> getRootFolder()["cave"] = cave
 
+  >>> from zope import component
   >>> from zope.app.component.hooks import getSite, setSite
   >>> setSite(cave)
   

Modified: grok/trunk/src/grok/ftests/utility/local_override.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/local_override.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/local_override.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -2,15 +2,10 @@
 Local Utilities can be registered on subclasses of grok.Site using
 grok.local_utility:
 
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.local_override import *
-
-  >>> grok.grok('grok.ftests.utility.local_override')
-
   >>> cave = SpikyCave()
   >>> getRootFolder()['cave'] = cave
 
+  >>> from zope import component
   >>> from zope.app.component.hooks import getSite, setSite
   >>> setSite(cave)
 

Deleted: grok/trunk/src/grok/ftests/utility/multiple_class.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/multiple_class.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/multiple_class.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,33 +0,0 @@
-"""
-When you try to register multiple classes with the same (interface, name)
-combination multiple times using grok.local_utility, we expect an error:
-
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.multiple_class import *
-
-  >>> grok.grok('grok.ftests.utility.multiple_class')
-  Traceback (most recent call last):
-    ...
-  GrokError: Conflicting local utility registration
-  <class 'grok.ftests.utility.multiple_class.Fireplace2'> in site
-  <class 'grok.ftests.utility.multiple_class.Cave'>.
-  Local utilities are registered multiple times for interface
-  <InterfaceClass grok.ftests.utility.multiple_class.IFireplace> and
-  name 'Foo'.  
-"""
-import grok
-from zope import interface
-
-class IFireplace(interface.Interface):
-    pass
-
-class Fireplace(grok.LocalUtility):
-    grok.implements(IFireplace)
-
-class Fireplace2(grok.LocalUtility):
-    grok.implements(IFireplace)
-    
-class Cave(grok.Model, grok.Site):
-    grok.local_utility(Fireplace, name='Foo')
-    grok.local_utility(Fireplace2, name='Foo')

Deleted: grok/trunk/src/grok/ftests/utility/multiple_directive.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/multiple_directive.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/multiple_directive.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,33 +0,0 @@
-"""
-When you call the grok.local_utility directive multiple times specifying
-the same (interface, name) combination, we expect an error:
-
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.multiple_directive import *
-
-  >>> grok.grok('grok.ftests.utility.multiple_directive')
-  Traceback (most recent call last):
-    ...
-  GrokError: Conflicting local utility registration
-  <class 'grok.ftests.utility.multiple_directive.Fireplace2'> in site
-  <class 'grok.ftests.utility.multiple_directive.Cave'>.
-  Local utilities are registered multiple times for interface
-  <InterfaceClass grok.ftests.utility.multiple_directive.IFireplace> and
-  name u''.  
-"""
-import grok
-from zope import interface
-
-class IFireplace(interface.Interface):
-    pass
-
-class Fireplace(grok.LocalUtility):
-    grok.implements(IFireplace)
-
-class Fireplace2(grok.LocalUtility):
-    grok.implements(IFireplace)
-    
-class Cave(grok.Model, grok.Site):
-    grok.local_utility(Fireplace, provides=IFireplace)
-    grok.local_utility(Fireplace2, provides=IFireplace)

Modified: grok/trunk/src/grok/ftests/utility/public.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/public.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/public.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -4,14 +4,10 @@
 that is the site. The name the utility should have in the container can
 be controlled using name_in_container:
 
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.public import *
-  >>> grok.grok('grok.ftests.utility.public')
-
   >>> cave = Cave()
   >>> getRootFolder()["cave"] = cave
 
+  >>> from zope import component
   >>> from zope.app.component.hooks import getSite, setSite
   >>> setSite(cave)
   >>> cave['fireplace'] is component.getUtility(IFireplace)

Deleted: grok/trunk/src/grok/ftests/utility/publicnoncontainer.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/publicnoncontainer.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/publicnoncontainer.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,26 +0,0 @@
-"""
-You cannot use local_utility with 'public' set to True if the site class
-isn't a container:
-
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.publicnoncontainer import *
-  >>> grok.grok('grok.ftests.utility.publicnoncontainer')
-  Traceback (most recent call last):
-    ...
-  GrokError: Cannot set public to True with grok.local_utility as the site
-  (<class 'grok.ftests.utility.publicnoncontainer.Cave'>) is not a container.
-
-"""
-
-import grok
-from zope import interface
-
-class IFireplace(interface.Interface):
-    pass
-
-class Fireplace(grok.LocalUtility):
-    grok.implements(IFireplace)
-    
-class Cave(grok.Model, grok.Site):
-    grok.local_utility(Fireplace, public=True, name_in_container='fireplace')

Modified: grok/trunk/src/grok/ftests/utility/subclass.py
===================================================================
--- grok/trunk/src/grok/ftests/utility/subclass.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/utility/subclass.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,15 +1,10 @@
 """
 Subclassed sites inherit all local utilities of their base classes:
 
-  >>> import grok
-  >>> from zope import component
-  >>> from grok.ftests.utility.subclass import *
-
-  >>> grok.grok('grok.ftests.utility.subclass')
-
   >>> cave = BigCave()
   >>> getRootFolder()["cave"] = cave
 
+  >>> from zope import component
   >>> from zope.app.component.hooks import getSite, setSite
 
   >>> setSite(cave)

Modified: grok/trunk/src/grok/ftests/view/argument.py
===================================================================
--- grok/trunk/src/grok/ftests/view/argument.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/view/argument.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,7 +1,4 @@
 """
-  >>> import grok
-  >>> from grok.ftests.view.argument import Mammoth
-  >>> grok.grok('grok.ftests.view.argument')
   >>> getRootFolder()["manfred"] = Mammoth()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/view/index.py
===================================================================
--- grok/trunk/src/grok/ftests/view/index.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/view/index.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,7 +1,4 @@
 """
-  >>> import grok
-  >>> from grok.ftests.view.index import Mammoth
-  >>> grok.grok('grok.ftests.view.index')
   >>> getRootFolder()["manfred"] = Mammoth()
 
 The default view name for a model is 'index':

Modified: grok/trunk/src/grok/ftests/view/macros.py
===================================================================
--- grok/trunk/src/grok/ftests/view/macros.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/view/macros.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,7 +1,4 @@
 """
-  >>> import grok
-  >>> from grok.ftests.view.macros import Mammoth
-  >>> grok.grok('grok.ftests.view.macros')
   >>> getRootFolder()["manfred"] = Mammoth()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/view/view.py
===================================================================
--- grok/trunk/src/grok/ftests/view/view.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/view/view.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,7 +1,4 @@
 """
-  >>> import grok
-  >>> from grok.ftests.view.view import Mammoth
-  >>> grok.grok('grok.ftests.view.view')
   >>> getRootFolder()["manfred"] = Mammoth()
 
   >>> from zope.testbrowser.testing import Browser

Modified: grok/trunk/src/grok/ftests/xmlrpc/xmlrpc.py
===================================================================
--- grok/trunk/src/grok/ftests/xmlrpc/xmlrpc.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/ftests/xmlrpc/xmlrpc.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -1,12 +1,9 @@
 """
-  >>> import grok
-  >>> grok.grok('grok.ftests.xmlrpc.xmlrpc')
-  >>> from grok.ftests.xmlrpc.xmlrpc import Mammoth
   >>> getRootFolder()["Manfred"] = Mammoth()
 
-  >>> from grok.ftests.xmlrpc_helper import ServerProxy
-
+  >>> from zope.app.testing.xmlrpc import ServerProxy
   >>> server = ServerProxy("http://localhost/")
+
   >>> server.Manfred.stomp()
   'Manfred stomped.'
   >>> server.Manfred.dance()

Copied: grok/trunk/src/grok/tests/catalog (from rev 79251, grok/branches/philikon-ftest-layer-does-fixture-setup/src/grok/tests/catalog)

Modified: grok/trunk/src/grok/tests/test_grok.py
===================================================================
--- grok/trunk/src/grok/tests/test_grok.py	2007-08-29 16:49:12 UTC (rev 79365)
+++ grok/trunk/src/grok/tests/test_grok.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -32,7 +32,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    for name in ['adapter', 'error', 'view', 'event', 'security',
+    for name in ['adapter', 'error', 'view', 'event', 'security', 'catalog',
                  'zcml', 'static', 'utility', 'xmlrpc', 'json', 'container',
                  'traversal', 'form', 'site', 'grokker', 'directive', 'util',
                  'baseclass', 'annotation', 'application']:

Copied: grok/trunk/src/grok/tests/utility/multiple_class.py (from rev 79251, grok/branches/philikon-ftest-layer-does-fixture-setup/src/grok/tests/utility/multiple_class.py)
===================================================================
--- grok/trunk/src/grok/tests/utility/multiple_class.py	                        (rev 0)
+++ grok/trunk/src/grok/tests/utility/multiple_class.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -0,0 +1,29 @@
+"""
+When you try to register multiple classes with the same (interface, name)
+combination multiple times using grok.local_utility, we expect an error:
+
+  >>> grok.grok(__name__)
+  Traceback (most recent call last):
+    ...
+  GrokError: Conflicting local utility registration
+  <class 'grok.tests.utility.multiple_class.Fireplace2'> in site
+  <class 'grok.tests.utility.multiple_class.Cave'>.
+  Local utilities are registered multiple times for interface
+  <InterfaceClass grok.tests.utility.multiple_class.IFireplace> and
+  name 'Foo'.  
+"""
+import grok
+from zope import interface
+
+class IFireplace(interface.Interface):
+    pass
+
+class Fireplace(grok.LocalUtility):
+    grok.implements(IFireplace)
+
+class Fireplace2(grok.LocalUtility):
+    grok.implements(IFireplace)
+    
+class Cave(grok.Model, grok.Site):
+    grok.local_utility(Fireplace, name='Foo')
+    grok.local_utility(Fireplace2, name='Foo')

Copied: grok/trunk/src/grok/tests/utility/multiple_directive.py (from rev 79251, grok/branches/philikon-ftest-layer-does-fixture-setup/src/grok/tests/utility/multiple_directive.py)
===================================================================
--- grok/trunk/src/grok/tests/utility/multiple_directive.py	                        (rev 0)
+++ grok/trunk/src/grok/tests/utility/multiple_directive.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -0,0 +1,29 @@
+"""
+When you call the grok.local_utility directive multiple times specifying
+the same (interface, name) combination, we expect an error:
+
+  >>> grok.grok(__name__)
+  Traceback (most recent call last):
+    ...
+  GrokError: Conflicting local utility registration
+  <class 'grok.tests.utility.multiple_directive.Fireplace2'> in site
+  <class 'grok.tests.utility.multiple_directive.Cave'>.
+  Local utilities are registered multiple times for interface
+  <InterfaceClass grok.tests.utility.multiple_directive.IFireplace> and
+  name u''.  
+"""
+import grok
+from zope import interface
+
+class IFireplace(interface.Interface):
+    pass
+
+class Fireplace(grok.LocalUtility):
+    grok.implements(IFireplace)
+
+class Fireplace2(grok.LocalUtility):
+    grok.implements(IFireplace)
+    
+class Cave(grok.Model, grok.Site):
+    grok.local_utility(Fireplace, provides=IFireplace)
+    grok.local_utility(Fireplace2, provides=IFireplace)

Copied: grok/trunk/src/grok/tests/utility/publicnoncontainer.py (from rev 79251, grok/branches/philikon-ftest-layer-does-fixture-setup/src/grok/tests/utility/publicnoncontainer.py)
===================================================================
--- grok/trunk/src/grok/tests/utility/publicnoncontainer.py	                        (rev 0)
+++ grok/trunk/src/grok/tests/utility/publicnoncontainer.py	2007-08-29 16:56:27 UTC (rev 79366)
@@ -0,0 +1,23 @@
+"""
+You cannot use local_utility with 'public' set to True if the site class
+isn't a container:
+
+  >>> grok.grok(__name__)
+  Traceback (most recent call last):
+    ...
+  GrokError: Cannot set public to True with grok.local_utility as the site
+  (<class 'grok.tests.utility.publicnoncontainer.Cave'>) is not a container.
+
+"""
+
+import grok
+from zope import interface
+
+class IFireplace(interface.Interface):
+    pass
+
+class Fireplace(grok.LocalUtility):
+    grok.implements(IFireplace)
+    
+class Cave(grok.Model, grok.Site):
+    grok.local_utility(Fireplace, public=True, name_in_container='fireplace')



More information about the Checkins mailing list