def __enter__(self): """ Starts all patched objects using 'with' context management. Does not return anything for 'as' keyword. """ for patch in self.patch_objects: patch.start()
def setup_module(): global mock_request global response mock_request = patch.start() mock_request = mock_request() mock_request = mock_request.request mock_request.return_value = response = mock()
def mock(): global mock_request mock_request = patch.start()().request
def setup_module(): global mock_request mock_request = patch.start()().request
def __enter__(self): for patch in self.settings_patches: patch.start() self.patcher.start().return_value = self.return_value
def install(patch): patch.start() self.addCleanup(patch.stop)
def apply_patch(self, patch): obj = patch.start() self.addCleanup(patch.stop) return obj