Blog

The Digital Agency for International Development

Entries tagged "monkeypatches"

Temporary monkey patches in Python tests

Did some refactoring on the Intranet Binder monkeypatch library to enable temporary patches using Python's context objects. This is particularly nice for use in unit tests, where you might need to mock or stub out a component's dependencies, but you don't want those changes to be visible after your test finishes, or you only want them active for part of the test.

By Chris Wilson on 30 January 2013