Skip to content

Commit ce5f41e

Browse files
committed
Add 30s cap time for tag tests
1 parent d170f19 commit ce5f41e

File tree

6 files changed

+33
-6
lines changed

6 files changed

+33
-6
lines changed

tests/integ/sagemaker/lineage/conftest.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ def artifact_obj_with_association(sagemaker_session, artifact_obj):
155155
@pytest.fixture
156156
def trial_component_obj(sagemaker_session):
157157
trial_component_obj = trial_component.TrialComponent.create(
158-
trial_component_name=name(), sagemaker_boto_client=sagemaker_session.sagemaker_client
158+
trial_component_name=name(),
159+
sagemaker_boto_client=sagemaker_session.sagemaker_client,
159160
)
160161
yield trial_component_obj
161162
time.sleep(0.5)
@@ -190,7 +191,9 @@ def experiment_obj(sagemaker_session):
190191

191192

192193
@pytest.fixture
193-
def trial_associated_artifact(artifact_obj, trial_obj, trial_component_obj, sagemaker_session):
194+
def trial_associated_artifact(
195+
artifact_obj, trial_obj, trial_component_obj, sagemaker_session
196+
):
194197
assntn = association.Association.create(
195198
source_arn=artifact_obj.artifact_arn,
196199
destination_arn=trial_component_obj.trial_component_arn,
@@ -247,7 +250,9 @@ def artifact_obj1(sagemaker_session):
247250

248251

249252
@pytest.fixture
250-
def dataset_artifact_associated_models(sagemaker_session, trial_component_obj, model_artifact_obj1):
253+
def dataset_artifact_associated_models(
254+
sagemaker_session, trial_component_obj, model_artifact_obj1
255+
):
251256
dataset_artifact_obj = artifact.DatasetArtifact.create(
252257
artifact_name="dataset-artifact-name",
253258
artifact_type="Context",
@@ -389,7 +394,9 @@ def context_obj_with_association(sagemaker_session, action_obj):
389394

390395

391396
@pytest.fixture
392-
def endpoint_context_associate_with_model(sagemaker_session, endpoint_action_obj, model_obj):
397+
def endpoint_context_associate_with_model(
398+
sagemaker_session, endpoint_action_obj, model_obj
399+
):
393400
context_name = name()
394401
obj = context.EndpointContext.create(
395402
source_uri="endpontContextWithModel" + context_name,

tests/integ/sagemaker/lineage/test_action.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import datetime
1717
import logging
1818

19+
import pytest
20+
1921
from sagemaker.lineage import action
2022

2123

@@ -80,6 +82,7 @@ def test_list(action_objs, sagemaker_session):
8082
assert action_names
8183

8284

85+
@pytest.mark.timeout(30)
8386
def test_tag(action_obj, sagemaker_session):
8487
tag = {"Key": "foo", "Value": "bar"}
8588
action_obj.set_tag(tag)
@@ -96,6 +99,7 @@ def test_tag(action_obj, sagemaker_session):
9699
assert actual_tags[0] == tag
97100

98101

102+
@pytest.mark.timeout(30)
99103
def test_tags(action_obj, sagemaker_session):
100104
tags = [{"Key": "foo1", "Value": "bar1"}]
101105
action_obj.set_tags(tags)

tests/integ/sagemaker/lineage/test_artifact.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import logging
1818
import time
1919

20+
import pytest
21+
2022
from sagemaker.lineage import artifact
2123

2224

@@ -103,14 +105,17 @@ def test_downstream_trials(trial_associated_artifact, trial_obj, sagemaker_sessi
103105
# allow trial components to index, 30 seconds max
104106
for i in range(3):
105107
time.sleep(10)
106-
trials = trial_associated_artifact.downstream_trials(sagemaker_session=sagemaker_session)
108+
trials = trial_associated_artifact.downstream_trials(
109+
sagemaker_session=sagemaker_session
110+
)
107111
if len(trials) > 0:
108112
break
109113

110114
assert len(trials) == 1
111115
assert trial_obj.trial_name in trials
112116

113117

118+
@pytest.mark.timeout(30)
114119
def test_tag(artifact_obj, sagemaker_session):
115120
tag = {"Key": "foo", "Value": "bar"}
116121
artifact_obj.set_tag(tag)
@@ -127,6 +132,7 @@ def test_tag(artifact_obj, sagemaker_session):
127132
assert actual_tags[0] == tag
128133

129134

135+
@pytest.mark.timeout(30)
130136
def test_tags(artifact_obj, sagemaker_session):
131137
tags = [{"Key": "foo1", "Value": "bar1"}]
132138
artifact_obj.set_tags(tags)

tests/integ/sagemaker/lineage/test_association.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import datetime
1717
import time
1818

19+
import pytest
20+
1921
from sagemaker.lineage import association
2022

2123

@@ -28,7 +30,8 @@ def test_list(association_objs, sagemaker_session):
2830
slack = datetime.timedelta(minutes=1)
2931
now = datetime.datetime.now(datetime.timezone.utc)
3032
association_keys = [
31-
assoc_obj.source_arn + ":" + assoc_obj.destination_arn for assoc_obj in association_objs
33+
assoc_obj.source_arn + ":" + assoc_obj.destination_arn
34+
for assoc_obj in association_objs
3235
]
3336

3437
for sort_order in ["Ascending", "Descending"]:
@@ -55,6 +58,7 @@ def test_list(association_objs, sagemaker_session):
5558
assert association_keys_listed
5659

5760

61+
@pytest.mark.timeout(30)
5862
def test_set_tag(association_obj, sagemaker_session):
5963
tag = {"Key": "foo", "Value": "bar"}
6064
association_obj.set_tag(tag)
@@ -72,6 +76,7 @@ def test_set_tag(association_obj, sagemaker_session):
7276
assert actual_tags[0] == tag
7377

7478

79+
@pytest.mark.timeout(30)
7580
def test_tags(association_obj, sagemaker_session):
7681
tags = [{"Key": "foo1", "Value": "bar1"}]
7782
association_obj.set_tags(tags)

tests/integ/sagemaker/lineage/test_context.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import datetime
1717
import logging
1818

19+
import pytest
20+
1921
from sagemaker.lineage import context
2022

2123

@@ -78,6 +80,7 @@ def test_list(context_objs, sagemaker_session):
7880
assert context_names
7981

8082

83+
@pytest.mark.timeout(30)
8184
def test_tag(context_obj, sagemaker_session):
8285
tag = {"Key": "foo", "Value": "bar"}
8386
context_obj.set_tag(tag)
@@ -94,6 +97,7 @@ def test_tag(context_obj, sagemaker_session):
9497
assert actual_tags[0] == tag
9598

9699

100+
@pytest.mark.timeout(30)
97101
def test_tags(context_obj, sagemaker_session):
98102
tags = [{"Key": "foo1", "Value": "bar1"}]
99103
context_obj.set_tags(tags)

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ markers =
5555
canary_quick
5656
cron
5757
local_mode
58+
timeout: mark a test as a timeout.
5859

5960
[testenv]
6061
passenv =

0 commit comments

Comments
 (0)