def generate(snapshot_type: Type[T]) -> Iterator[T]: """Generate a snapshot using the specified snapshot type. The argument must be a subclass of BaseSnapshot. This should be used in a `with` statement. This method generates the snapshot in a temporary directory that will be cleaned up when exiting the `with` context. """ with create_tmp_dir() as tmpdir: snapshot = snapshot_type(tmpdir) snapshot.generate() yield snapshot
def generate(snapshot_type: Type[T]) -> Iterator[T]: """Generate a snapshot using the specified snapshot type. The argument must be a subclass of BaseSnapshot. This should be used in a `with` statement. This method generates the snapshot in a temporary directory that will be cleaned up when exiting the `with` context. """ with create_tmp_dir() as tmpdir: snapshot = snapshot_type(tmpdir) snapshot.generate() yield snapshot