[Zope-dev] ZopeTestCase and interactions

Martin Aspeli optilude+lists at gmail.com
Sun Jul 26 20:57:08 EDT 2009


Hanno Schlichting wrote:
> On Sun, Jul 26, 2009 at 5:21 PM, Martin Aspeli<optilude+lists at gmail.com> wrote:
>> The problem is that the interaction threadlocal isn't set up, so you get
>> an AttributeError.
>>
>> It's easy to fix: just call Products.Five.security.newInteraction()
>> before the test is run.
>>
>> Is this something that should go into ZopeTestCase's setUp()?
> 
> The ZopeTestCase classes themselves don't set up any of the ZCML
> structure right now and I'd like to keep it that way.

True. This isn't a ZCML, thing, though. :)

> Isn't the placeless layer exactly for this use-case of getting some
> "minimal integration" fixture set up? Since Zope 2.12 a Zope2 specific
> version of that is in Testing.ZopeTestCase.placeless. Before you would
> get it from zope.app.testing.placelesssetup.

I see. That sounds like a sensible place. My main aim is that when you 
use a PloneTestCase, you should get the interaction set up so that calls 
to zope.security.checkPermission() don't fail. Does PTC and other 
similar things set up the placeless layer? Or something like it?

> The module in Testing.ZopeTestCase uses "from zope.security.management
> import newInteraction" though and not Five. Maybe it should use the
> Five version instead?

Almost certainly.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-Dev mailing list