Forgot to include the list in my reply...
On 23/11/2018 22:27, Chris Withers wrote:
On 23/11/2018 22:22, Glyph wrote:
On Nov 23, 2018, at 7:58 AM, Chris Withers email@example.com wrote:
Does trial do anything to clean up stuff that's been passed to deferToThread?
Nope. It does its best to clean up stuff that it knows is "in" the reactor (sockets, timers, and the like), but since threads can kind of do ~whatever~ there hasn't been support for that.
Actually, looks like there's stuff in trial's Janitor class, but it only kicks in after the suite is finished, and I'm seeing leakage between tests within a suite...
deferToThread is a bit of a special case and you make a good point here: there should probably be special support for it in trial.
...which I plan to add in carly in the meantime: basically block with a timeout on everything in the threadpool finishing it's work.
Speaking of which, I'm happy with how carly is turning out, but would still welcome feedback, particularly on how the tests suites feel:
Just don't read hook.py unless you like head-bendy code ;-)
Okay, so here's what I came up with https://github.com/cjw296/carly/commit/71a1d2bfd501f5c561712c75253fc23c28c3bba7#diff-3670fb1f3b913f6c1ec584fa64302c2dR17. I'm not a fan of the sleep / busy loop pattern, but twisted makes it prettymuch impossible to get hold of the ThreadWorkers queue, so that I could block on them in this method. Any ideas on improvements would be very welcome!