16
16
17
17
import pytest
18
18
19
- from sagemaker import Session
20
19
from sagemaker .workflow .pipeline_context import PipelineSession
21
20
22
21
REGION = "us-west-2"
23
22
BUCKET = "my-bucket"
24
23
ROLE = "DummyRole"
25
24
IMAGE_URI = "fakeimage"
25
+ INSTANCE_TYPE = "ml.m4.xlarge"
26
26
27
27
28
28
@pytest .fixture (scope = "module" )
29
- def client ():
29
+ def mock_client ():
30
30
"""Mock client.
31
31
32
32
Considerations when appropriate:
@@ -38,11 +38,12 @@ def client():
38
38
client_mock ._client_config .user_agent = (
39
39
"Boto3/1.14.24 Python/3.8.5 Linux/5.4.0-42-generic Botocore/1.17.24 Resource"
40
40
)
41
+ client_mock .describe_model .return_value = {"PrimaryContainer" : {}, "Containers" : {}}
41
42
return client_mock
42
43
43
44
44
45
@pytest .fixture (scope = "module" )
45
- def boto_session (client ):
46
+ def mock_boto_session (client ):
46
47
role_mock = Mock ()
47
48
type(role_mock ).arn = PropertyMock (return_value = ROLE )
48
49
@@ -57,19 +58,9 @@ def boto_session(client):
57
58
58
59
59
60
@pytest .fixture (scope = "module" )
60
- def pipeline_session (boto_session , client ):
61
+ def pipeline_session (mock_boto_session , mock_client ):
61
62
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 ,
74
65
default_bucket = BUCKET ,
75
66
)
0 commit comments