[z3-five] testings event firing

Chris Withers chris at simplistix.co.uk
Wed Feb 7 17:06:28 CET 2007


Hi All,

This starts of with me wanting to test that I've inserted the correct 
calls to event.notify in my code.

So, the natural way would be to have a dummy subscriber, and then 
exercise the code where event.notify should be present, right?

Okay, but if I just do:

class mySubscriber:

   def __init__(self):
     self.events = []

   def __call__(self,*args,**kw):
     self.events.append((args,kw))

s = mySubscriber()
provideHandler(s,IWhatever)

....then that handler will get called for every event in the test run, 
right?

How do I get rid of it once I'm done with a particular test?

I tried playing with subclassing zope.component.testing.PlacelessSetup 
but that trashed all my normal zcml setup.

I guess a secondary question then becomes how do you unit test that the 
assignments in your .zcml files are correct?

Is this the realm of functional tests? If so, how do you run functional 
and unit tests in the same run? Are there any docs or examples of all this?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the z3-five mailing list