The pythonic way to guard resources is using a with statement. This patch adds a class that allows the creation and deletion of temporary files using a with statement.
This looks reasonable to me.
Can self._evaluate_test throw?
If so, you'll skip the call to _clean.
On the other hand, _clean appears to be empty now.
I would like @danalbert to comment on this. I think he uses _clean() in the android configuration.
_clean() should be thought of as a virtual method. It needs to be overridden for remote execution because the steps taken to clean up remote workspaces will vary.
Doesn't contextlib cover this?
This is no longer relevant.