Comment 2 for bug 310770

Revision history for this message
Jonathan Lange (jml) wrote :

I don't feel strongly about it.

'TestCase.patch' has proven itself to be very convenient and readable in Twisted.
    self.patch(sys, 'time', newfoo)
is more readable than:
    self.addCleanup(monkey.patch, sys, 'time', newfoo)
or even
    self.addCleanup(monkey.patch(sys.time, newfoo))

And if monkey.patch can be implemented in the last way (I'm not so sure), then TestCase.patch could be written as:
    self.patch(sys.time, newfoo)

Which makes the intent very clear.