Jono; this seems like something we shouldn't have in testtools. Rather: There should be a library for monkey patching. It should have an API we can trivially use (e.g. it returns (callback, (args), {kwargs}), which users can pass to addCleanup:
def newfoo(): pass self.addCleanup(monkey.patch(sys.time, newfoo))
What do you think?
Jono; this seems like something we shouldn't have in testtools. Rather:
There should be a library for monkey patching.
It should have an API we can trivially use (e.g. it returns (callback, (args), {kwargs}), which users can pass to addCleanup:
def newfoo(): (monkey. patch(sys. time, newfoo))
pass
self.addCleanup
What do you think?