Skip to content

Commit

Permalink
infra: change bucket creation setup for integ tests (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
avawang1 authored Oct 2, 2020
1 parent dd7c4c8 commit 71434b2
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions test/integ_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import boto3
import pytest
from botocore.exceptions import ClientError

from braket.aws.aws_session import AwsSession

Expand Down Expand Up @@ -44,20 +43,8 @@ def s3_bucket(s3_resource, boto_session):
account_id = boto_session.client("sts").get_caller_identity()["Account"]
bucket_name = f"amazon-braket-sdk-integ-tests-{account_id}"
bucket = s3_resource.Bucket(bucket_name)

try:
if not bucket.creation_date:
bucket.create(ACL="private", CreateBucketConfiguration={"LocationConstraint": region_name})
except ClientError as e:
code = e.response["Error"]["Code"]

# Bucket exists in profile region
if code == "BucketAlreadyOwnedByYou":
pass
# Bucket exists in another region
elif code == "IllegalLocationConstraintException" and bucket.creation_date:
pass
else:
raise e

return bucket_name

Expand Down

0 comments on commit 71434b2

Please sign in to comment.