Changes between Version 1 and Version 2 of Ticket #2433, comment 7
- Timestamp:
- 2015-05-27T00:20:16Z (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #2433, comment 7
v1 v2 1 I looked at the implementation of `NamedTemporaryFile` in pyutil, and I think it may notwork correctly for asynchronous tests. The problem is that the `NamedTemporaryFile` object may go out of scope and have its `__del__` method called before all of the callback/errback chains associated with the test have finished (it's possible that the closures of those callbacks/errbacks might hold on to the object for long enough, but that seems error-prone and complicated to reason about).1 I looked at the implementation of `NamedTemporaryFile` in pyutil, and I am not convinced that it would work correctly for asynchronous tests. The problem is that the `NamedTemporaryFile` object may go out of scope and have its `__del__` method called before all of the callback/errback chains associated with the test have finished (it's possible that the closures of those callbacks/errbacks might hold on to the object for long enough, but that seems error-prone and complicated to reason about). 2 2 3 3 If we were going to add automatic cleanup, I would want it to only be triggered in the test's cleanup phase. Even that is potentially a problem for diagnosing what happened by looking at the files under `_trial_temp` in case of a test failure.