testtools.monkey
module documentationtesttools
Class | MonkeyPatcher | A set of monkey-patches that can be applied and removed all together. |
Function | patch | Set 'obj.attribute' to 'value' and return a callable to restore 'obj'. |
Set 'obj.attribute' to 'value' and return a callable to restore 'obj'.
If 'attribute' is not set on 'obj' already, then the returned callable will delete the attribute when called.
Parameters | obj | An object to monkey-patch. |
attribute | The name of the attribute to patch. | |
value | The value to set 'obj.attribute' to. | |
Returns | A nullary callable that, when run, will restore 'obj' to its original state. |