def unpatched_httplib_context(cassette_library): """Create a context in which httplib is unpatched.""" from cassette.patcher import patch, unpatch unpatch() yield patch(cassette_library)
def eject(): """Remove cassette, unpatching HTTP requests.""" # If the cassette items have changed, save the changes to file if cassette_library.is_dirty: cassette_library.write_to_file() # Remove our overrides unpatch()
def backfire(): patch(None, backfire=True) yield unpatch()
def __exit__(self, exc_type, exc_value, tb): # If the cassette items have changed, save the changes to file if self.library.is_dirty: self.library.write_to_file() # Remove our overrides unpatch()