There seems to be an undocumented function named remove() in the
sqlalchemy.event module that looks like what I want, but it doesn't work:
Traceback (most recent call last):
File
"/home/alex/virtualenv/triancore/lib/python3.3/site-packages/nose/case.py",
line 198, in runTest
self.test(*self.arg)
File "/home/alex/workspace/TrianCore/tests/rpc/test_eventpublisher.py",
line 36, in test_stop_publisher
self.publisher.stop()
File "/home/alex/workspace/TrianCore/trian/core/rpc/eventpublisher.py",
line 62, in stop
event.remove(Session, 'after_flush', self.queue_events)
File
"/home/alex/virtualenv/triancore/lib/python3.3/site-packages/sqlalchemy/event.py",
line 76, in remove
for tgt in evt_cls._accept_with(target):
nose.proxy.TypeError: 'type' object is not iterable
keskiviikko, 11. syyskuuta 2013 20.16.49 UTC+3 Alex Grönholm kirjoitti:
>
> 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,
> breaking test isolation. The ideal solution would be to unregister the
> listener in teardown(), but I don't see anything in the event API that
> could be used to do that.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.