<html><body>On 12:58 am, slamb@slamb.org wrote:<br />&gt;It appears I can't use reference handling to &#160;clean up <br />&gt;resources within a trial - the output code apparently keeps &#160;a reference to <br />&gt;the stack trace or something until after it's done. &#160;That's too late for me <br />&gt;- this resource is essentially a mutex, so if &#160;I have more than one TestCase <br />&gt;in a single trial run, my tests don't &#160;work.<br /><br />I can't speak to the intentionality of that particular change, but there are many cases where code (not necessarily trial) will do something like this temporarily. &#160;You should always treat __del__ as slightly non-deterministic unless you have a very tightly controlled test _specifically_ for your __del__ and it includes a gc.collect().<br /><br />Do startup / cleanup with the 'setUp' and 'tearDown' TestCase methods. &#160;Don't depend on garbage collection: this goes for both your application and your test code. &#160;Implicitly depending on the garbage collector's behavior will very likely make your program break under the debugger, but not under normal operation (or vice versa).<br /></body></html>