class documentation
Cover up attributes with new objects. Neat for monkey-patching things for unit-testing purposes.
Method | __exit__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | add |
Add a patch so that the attribute name on obj will be assigned to value when patch is called or during runWithPatches. |
Method | patch |
Apply all of the patches that have been specified with addPatch . Reverse this operation using restore . |
Method | restore |
Restore all original values to any patched objects. |
Method | run |
Apply each patch already specified. Then run the function f with the given args and kwargs. Restore everything when done. |
Method | _already |
Has the name attribute of obj already been patched by this patcher? |
Instance Variable | _originals |
Undocumented |
Instance Variable | _patches |
Undocumented |
Add a patch so that the attribute name on obj will be assigned to value when patch is called or during runWithPatches.
You can restore the original values with a call to restore().
Apply each patch already specified. Then run the function f with the given args and kwargs. Restore everything when done.