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)
Exemple #2
0
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()
Exemple #3
0
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()
Exemple #4
0
def backfire():
    patch(None, backfire=True)
    yield
    unpatch()
Exemple #5
0
 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()