Skip to content

Commit dea989b

Browse files
committed
improve logging and retry of trial add/remove TC test
1 parent de3dfaa commit dea989b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/integ/test_trial.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
import datetime
1515

16+
import logging
17+
1618
from smexperiments import trial
1719
from smexperiments.search_expression import SearchExpression, Filter, Operator
1820
from tests.helpers import retry
@@ -109,15 +111,24 @@ def test_search(sagemaker_boto_client):
109111

110112
def test_add_remove_trial_component(trial_obj, trial_component_obj):
111113
trial_obj.add_trial_component(trial_component_obj)
114+
logging.info(f"Added trial component {trial_component_obj.trial_component_name} to trial {trial_obj.trial_name}")
112115

113-
def validate():
116+
def validate_add():
114117
trial_components = list(trial_obj.list_trial_components())
115-
assert 1 == len(trial_components)
116-
trial_obj.remove_trial_component(trial_component_obj)
118+
assert 1 == len(trial_components), "Expected trial component to be included in trials list of TC"
119+
120+
retry(validate_add)
121+
122+
trial_obj.remove_trial_component(trial_component_obj)
123+
logging.info(
124+
f"Removed trial component {trial_component_obj.trial_component_name} from trial {trial_obj.trial_name}"
125+
)
126+
127+
def validate_remove():
117128
trial_components = list(trial_obj.list_trial_components())
118-
assert 0 == len(trial_components)
129+
assert 0 == len(trial_components), "Expected trial component to be removed from trials list of TC"
119130

120-
retry(validate, num_attempts=4)
131+
retry(validate_remove)
121132

122133

123134
def test_save(trial_obj, sagemaker_boto_client):

0 commit comments

Comments
 (0)