[py-dev] "event" branch and architecture

holger krekel holger at merlinux.de
Fri Feb 1 12:45:53 CET 2008


Hey tav! 

On Fri, Feb 01, 2008 at 11:21 +0000, tav wrote:
> Hey Holger,
> 
> > i am currently hammering on the svn/py/branch/event branch [*].
> > The main intention is to modify py.test's internal architecture
> > towards using events and to base reporting and some internal
> > processing on these events.
> 
> Whilst Zope's event system is nice in its simplicity, it suffers from
> many faults once you go beyond the basic use cases. The easiest one to
> explain is race conditions that take place with regards to nested
> subscriptions. That is, when calling a subscriber/listener with an
> event, if that action adds a new listener... and/or notifies the
> Hub... you have a lot of pain to work around.

I can see that triggering events nestedly can be problematic.
But I am not sure it is a problem for the upcoming py.test use cases and if so 
i think we could extend the hub's notify protocol to allow subscribers to 
return new events that are to trigger notification after the current run is through. 

> Now, throw in exceptions into that and *boom*, you have a rather messy
> minefield.

Well, subscribers need to take care for dealing with exceptions. 
We could do a "try-except" but then what do we do with the exception, anyway? 

For me, the beauty of the z3 event loop lies in the fact that every python 
programmer can understand easily what he is dealing with if 
wanting to have a subscriber (or notifier) participate. 

> Can I recommend using Trellis by any chance?

sure, you are welcome!  

> * http://peak.telecommunity.com/DevCenter/Trellis
> 
> It solves a lot of very difficult problems rather elegantly and the
> core is just 450 lines of code!! Whilst the documentation is a tad
> confusing, it does have a lot of it and some parts are written very
> nicely.

Introducing events for py.test particularly aims at *decoupling* things, 
also to allow for "plugin" based features.  Isn't Trellis rather
aiming at coupling things automatically? 

I haven't looked at the Trellis code (is it using other PEAK
code btw?) but from reading the web page i appears to me that
Trellis is a framework rather than a simple pattern - the py
lib avoids to do frameworkish things like introducing
subclassing requirements.  

best & cheers, 

holger

-- 
Holger Krekel - freelance manager and programmer 
merlinux GmbH: http://merlinux.de 
py.test: http://pytest.org 
py lib: http://pylib.org 
PyPy: http://codespeak.net/pypy 



More information about the Pytest-dev mailing list