Skip to content

Commit 9d3b727

Browse files
committed
add integ tests for list trial component by trial name and experiment name
1 parent d548937 commit 9d3b727

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

tests/integ-jobs/test_track_from_processing_job.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# language governing permissions and limitations under the License.
1313

1414
import sys
15-
15+
import pytest
1616
from tests.helpers import *
1717

1818
from smexperiments import trial_component, api_types
@@ -35,7 +35,7 @@ def wait_for_job(job, sagemaker_client):
3535
sys.stdout.flush()
3636
time.sleep(30)
3737

38-
38+
@pytest.mark.skip(reason="to be only run manually, integ/canaries already cover this scenario")
3939
def test_track_from_processing_job(sagemaker_boto_client, processing_job_name):
4040
processing_job = sagemaker_boto_client.describe_processing_job(ProcessingJobName=processing_job_name)
4141

tests/integ-jobs/test_track_from_training_job.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import sys
1515
import boto3
16+
import pytest
1617

1718
from tests.helpers import *
1819
from smexperiments import trial_component
@@ -58,7 +59,7 @@ def wait_for_job(job, sagemaker_client):
5859
sys.stdout.flush()
5960
time.sleep(30)
6061

61-
62+
@pytest.mark.skip(reason="to be only run manually, integ/canaries already cover this scenario")
6263
def test_track_from_training_job(sagemaker_boto_client, training_job_name):
6364
tj = sagemaker_boto_client.describe_training_job(TrainingJobName=training_job_name)
6465
source_arn = tj['TrainingJobArn']

tests/integ/test_experiment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ def test_list_trials(experiment_obj, trials):
9494
assert set(trial_names) == set([s.trial_name for s in experiment_obj.list_trials()])
9595
assert trial_names # sanity test
9696

97+

tests/integ/test_trial.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ def test_list_sort(trials, sagemaker_boto_client):
5555

5656
def test_add_remove_trial_component(trial_obj, trial_component_obj):
5757
trial_obj.add_trial_component(trial_component_obj)
58+
trial_components = list(trial_obj.list_trial_components())
59+
assert 1 == len(trial_components)
5860
trial_obj.remove_trial_component(trial_component_obj)
59-
61+
trial_components = list(trial_obj.list_trial_components())
62+
assert 0 == len(trial_components)
6063

6164
def test_save(trial_obj, sagemaker_boto_client):
6265
trial_obj.display_name = 'foo'

tests/integ/test_trial_component.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,18 @@ def test_list_sort(trial_components, sagemaker_boto_client):
7777
trial_component_names_listed = trial_component_names_listed[::-1]
7878
assert trial_component_names == trial_component_names_listed
7979
assert trial_component_names # sanity test
80+
81+
82+
def test_list_trial_components_by_experiment(experiment_obj, trial_component_obj, sagemaker_boto_client):
83+
trial_obj = experiment_obj.create_trial()
84+
trial_obj.add_trial_component(trial_component_obj)
85+
trial_components = list(trial_component.TrialComponent.list(
86+
sagemaker_boto_client=sagemaker_boto_client,
87+
experiment_name=experiment_obj.experiment_name))
88+
assert 1 == len(trial_components)
89+
trial_obj.remove_trial_component(trial_component_obj)
90+
trial_components = list(trial_component.TrialComponent.list(
91+
sagemaker_boto_client=sagemaker_boto_client,
92+
experiment_name=experiment_obj.experiment_name))
93+
assert 0 == len(trial_components)
94+
trial_obj.delete()

0 commit comments

Comments
 (0)