def bucket():
Creates a test bucket and deletes it upon completion.
client = storage.Client()
bucket_name = "bucket-lock-" + str(int(time.time()))
bucket = client.create_bucket(bucket_name)
yield bucket
bucket.delete(force=True)
After Change
Yields a bucket that is deleted after the test completes.
bucket = None
while bucket is None or bucket.exists():
bucket_name = "bucket-lock-{}".format(uuid.uuid4())
bucket = storage.Client().bucket(bucket_name)
bucket.create()
yield bucket
bucket.delete(force=True)