def _make_patch(self, target, **kwargs):
target_mock = mock.Mock(**kwargs)<EOL>patch = mock.patch(target, new=target_mock)<EOL>patch.start()<EOL>self.addCleanup(patch.stop)<EOL>return target_mock<EOL>
Patch `target` with mock for the duration of test run.