Add patch() functionality
Bug #310770 reported by
Jonathan Lange
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Fix Released
|
Wishlist
|
Jonathan Lange |
Bug Description
Twisted has a patch() method on TestCase that lets you easily monkey-patch existing attributes on objects. This would be very nice to have in testtools.
Changed in testtools: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in testtools: | |
importance: | Medium → Wishlist |
Changed in testtools: | |
status: | In Progress → Fix Released |
milestone: | none → next |
To post a comment you must log in.
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?