Message300730
GC cleanup is not guaranteed to be synchronous. You are observing normal Python behavior here. Cleanup does not happen until the TestCase instance is finalized (thus eliminating the self.dummy reference to your DummyClass). In the case of passing tests, that is after the '.' is printed. In the case of failing tests, that is after the failure is printed, which isn't until the failure summary is printed at after running all tests.
If it is important to you that DummyClass be finalized, you need to add an addCleanup call to your setUp method that will do whatever finalization you need done. Including doing 'del self.dummy' (or self.dummy = None) if you need the reference to it gone...but depending on garbage collection is a bad idea, so if you are doing that there is probably something sub-optimal about your design. |
|
Date |
User |
Action |
Args |
2017-08-22 23:20:06 | r.david.murray | set | recipients:
+ r.david.murray, paul.moore, tim.golden, zach.ware, steve.dower, MCBama |
2017-08-22 23:20:06 | r.david.murray | set | messageid: <1503444006.29.0.481549916153.issue31261@psf.upfronthosting.co.za> |
2017-08-22 23:20:06 | r.david.murray | link | issue31261 messages |
2017-08-22 23:20:06 | r.david.murray | create | |
|