Skip to content

Commit

Permalink
Move aws_region = os.environ["AWS_DEFAULT_REGION"] to __post_init__ i…
Browse files Browse the repository at this point in the history
…n CITestEnvironment to avoid errors during init in case the environment variable is not set AWS_DEFAULT_REGION and the tests don't run
  • Loading branch information
tkilias committed Nov 28, 2023
1 parent 4bb451e commit d01acc8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/ci_tests/fixtures/prepare_environment_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _create_sagemaker_policy(iam_client) -> str:

)
print(response)
return response["Policy"]["ARN"] # FIXME got key error in this line
return response["Policy"]["ARN"] # FIXME got key error in this line
except iam_client.exceptions.EntityAlreadyExistsException as ex:
print("'EntityAlreadyExistsException' exception is handled")
sts_client = boto3.client('sts')
Expand All @@ -186,7 +186,10 @@ class CITestEnvironment:
aws_s3_bucket: str
aws_sagemaker_role: str
connection_object_for_aws_credentials: str
aws_region: str = os.environ["AWS_DEFAULT_REGION"]
aws_region: str

def __post_init__(self):
self.aws_region = os.environ["AWS_DEFAULT_REGION"]

@property
def aws_bucket_uri(self) -> str:
Expand Down

0 comments on commit d01acc8

Please sign in to comment.