[Zope-dev] Re: Testing zope 3 utilities from zope 2

David Convent david.convent at naturalsciences.be
Tue Jun 12 04:32:34 EDT 2007


I've been looking for a solution during hours before posting the 
question, and of course I found the solution right after posting it.

I needed to use the setHooks() and setSite() from zope.app.component.hooks

Sorry for the noise on the list,
David

David Convent wrote:
> hi,
> 
> I'm writing a unit test for GS exportimport of the Plone 3.0 
> plone.app.viewletmanager product.
> the exportimport handler configures a storage which is a Zope 3 utility.
> 
> As I want to include support for same node attributes than the skins 
> tool exportimport handler, I took inspiration from the tests in 
> CMFCore/exportimport/tests.
> 
> My problem is that the utility keeps its settings in all test methods of 
> a test case.
> Therefore, I can not properly test the exportimport steps.
> 
> I tried to call unregisterUtility() in the tearDown() method of the test 
> class but that doesn't change anything.
> 
> Any suggesion on how to solve this particular problem?
> 
> Current state of the code is in 
> https://svn.plone.org/svn/plone/plone.app.viewletmanager/branches/6649-default-order-support/tests/test_exportimport.py 
> 
> 
> the test_z_means_last() test method output make it obvious, the utility 
> keeps its settings.
> 
> Thank you in advance,
> David
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )
> 



More information about the Zope-Dev mailing list