1616
1717import pytest
1818
19- from sagemaker import Session
2019from sagemaker .workflow .pipeline_context import PipelineSession
2120
2221REGION = "us-west-2"
2322BUCKET = "my-bucket"
2423ROLE = "DummyRole"
2524IMAGE_URI = "fakeimage"
25+ INSTANCE_TYPE = "ml.m4.xlarge"
2626
2727
2828@pytest .fixture (scope = "module" )
29- def client ():
29+ def mock_client ():
3030 """Mock client.
3131
3232 Considerations when appropriate:
@@ -38,11 +38,12 @@ def client():
3838 client_mock ._client_config .user_agent = (
3939 "Boto3/1.14.24 Python/3.8.5 Linux/5.4.0-42-generic Botocore/1.17.24 Resource"
4040 )
41+ client_mock .describe_model .return_value = {"PrimaryContainer" : {}, "Containers" : {}}
4142 return client_mock
4243
4344
4445@pytest .fixture (scope = "module" )
45- def boto_session (client ):
46+ def mock_boto_session (client ):
4647 role_mock = Mock ()
4748 type(role_mock ).arn = PropertyMock (return_value = ROLE )
4849
@@ -57,19 +58,9 @@ def boto_session(client):
5758
5859
5960@pytest .fixture (scope = "module" )
60- def pipeline_session (boto_session , client ):
61+ def pipeline_session (mock_boto_session , mock_client ):
6162 return PipelineSession (
62- boto_session = boto_session ,
63- sagemaker_client = client ,
64- default_bucket = BUCKET ,
65- )
66-
67-
68- @pytest .fixture (scope = "module" )
69- def sagemaker_session (boto_session , client ):
70- return Session (
71- boto_session = boto_session ,
72- sagemaker_client = client ,
73- sagemaker_runtime_client = client ,
63+ boto_session = mock_boto_session ,
64+ sagemaker_client = mock_client ,
7465 default_bucket = BUCKET ,
7566 )
0 commit comments