Thanks, I'll try to make it work with the latter method somehow. Clearing
all session event listeners is not an option because some of the code under
test relies on a permanent listener being there.
keskiviikko, 11. syyskuuta 2013 21.15.46 UTC+3 Michael Bayer kirjoitti:
>
> you can either remove
Thanks for the quick reply. I don't want to use prerelease versions of
SQLAlchemy though. Is there any recommended way of doing this in 0.8.2?
keskiviikko, 11. syyskuuta 2013 20.40.40 UTC+3 Michael Bayer kirjoitti:
>
>
> On Sep 11, 2013, at 1:16 PM, Alex Grönholm
> >
> wrote:
>
> > I'm trying
you can either remove all the listeners for a certain type, like this:
events.MapperEvents._clear()
the other alternative is wrap your events with a set that you control:
my_listeners = set()
@event.listens_for(target, "whatever")
def evt(target):
for listener in my_listeners:
On Sep 11, 2013, at 1:16 PM, Alex Grönholm wrote:
> I'm trying to test code that listens to session events on all sessions. I
> can't pin it on any particular session or even sessionmaker due to the
> architecture of the software (sessions are explicitly instantiated on the
> fly).
> All is w
I'm trying to test code that listens to session events on all sessions. I
can't pin it on any particular session or even sessionmaker due to the
architecture of the software (sessions are explicitly instantiated on the
fly).
All is well except that the listener sticks after the test is done,
br