[Twisted-Python] Bug in reactor.iterate()?
Twisted version: 1.2.0 Attached is a minimal test case to demonstrate behaviour I consider a bug in reactor.iterate() in the default reactor. You'll need to change the DB name, user and password, and pick a table that exists in your DB. The callbacks are never called while iterate() runs, but are called if iterate() is replaced with run(), or if run() is called after iterate(). Am I correct in considering this a bug? I found this while creating a unit test following the example at the bottom of http://www.twistedmatrix.com/documents/current/howto/test-standard. -- Sam "Eddie" Couter | mailto:sam@couter.dropbear.id.au Debian Developer | mailto:eddie@debian.org | jabber:sam@teknohaus.dyndns.org OpenPGP fingerprint: A46B 9BB5 3148 7BEA 1F05 5BD5 8530 03AE DE89 C75C
On Mon, 2004-04-26 at 00:27, Sam Couter wrote:
The callbacks are never called while iterate() runs, but are called if iterate() is replaced with run(), or if run() is called after iterate().
The threadpool used by the database is never initialized if you don't use run(). I suggest you look at twisted.test.test_enterprise and see how it deals with initializing and stopping the db in tests (or just use reactor.run() wiith reactor.crash(), though you'll still need to stop the threadpool manually). -- Itamar Shtull-Trauring http://itamarst.org Looking for a job -- http://itamarst.org/resume.html
Itamar Shtull-Trauring <itamar@itamarst.org> wrote:
The threadpool used by the database is never initialized if you don't use run(). I suggest you look at twisted.test.test_enterprise and see how it deals with initializing and stopping the db in tests (or just use reactor.run() wiith reactor.crash(), though you'll still need to stop the threadpool manually).
Ah... I already tried run() and crash(), but my test didn't terminate. Now I know why - the threadpool was still running. All works now, is good. Thanks. Suggestion: Turn this bug into a documented feature. :) -- Sam "Eddie" Couter | mailto:sam@couter.dropbear.id.au Debian Developer | mailto:eddie@debian.org | jabber:sam@teknohaus.dyndns.org OpenPGP fingerprint: A46B 9BB5 3148 7BEA 1F05 5BD5 8530 03AE DE89 C75C
participants (2)
-
Itamar Shtull-Trauring
-
Sam Couter