Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 42fdd2b

Browse files
committedAug 4, 2021
Update test_serverless.py
1 parent e8c59e5 commit 42fdd2b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed
 

‎tests/integ/test_serverless.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
URL = "https://sagemaker-integ-tests-data.s3.us-east-1.amazonaws.com/cat.jpeg"
2121

2222
REPOSITORY_NAME = "serverless-integ-test"
23+
REPOSITORY_REGION = "us-west-2"
2324
ROLE_NAME = "LambdaExecutionRole"
24-
REGION = "us-west-2"
2525

2626

2727
@pytest.fixture(name="image_uri", scope="module")
2828
def fixture_image_uri(account):
29-
return f"{account}.dkr.ecr.{REGION}.amazonaws.com/{REPOSITORY_NAME}:latest"
29+
return f"{account}.dkr.ecr.{REPOSITORY_REGION}.amazonaws.com/{REPOSITORY_NAME}:latest"
3030

3131

3232
@pytest.fixture(name="role", scope="module")
@@ -41,9 +41,12 @@ def fixture_client(boto_session):
4141

4242
@pytest.fixture(name="repository_exists", scope="module")
4343
def fixture_repository_exists(boto_session):
44-
client = boto_session.client("ecr")
45-
client.describe_repositories(repositoryNames=[REPOSITORY_NAME])
46-
return True
44+
client = boto_session.client("ecr", region_name=REPOSITORY_REGION)
45+
try:
46+
client.describe_repositories(repositoryNames=[REPOSITORY_NAME])
47+
return True
48+
except client.exceptions.RepositoryNotFoundException:
49+
return False
4750

4851

4952
def test_lambda(image_uri, role, client, repository_exists):

0 commit comments

Comments
 (0)
Please sign in to comment.