Skip to content

Commit

Permalink
add integ tests for list trial component by trial name and experiment…
Browse files Browse the repository at this point in the history
… name
  • Loading branch information
danabens committed Jan 14, 2020
1 parent d548937 commit 9d3b727
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/integ-jobs/test_track_from_processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.

import sys

import pytest
from tests.helpers import *

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


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

Expand Down
3 changes: 2 additions & 1 deletion tests/integ-jobs/test_track_from_training_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import sys
import boto3
import pytest

from tests.helpers import *
from smexperiments import trial_component
Expand Down Expand Up @@ -58,7 +59,7 @@ def wait_for_job(job, sagemaker_client):
sys.stdout.flush()
time.sleep(30)


@pytest.mark.skip(reason="to be only run manually, integ/canaries already cover this scenario")
def test_track_from_training_job(sagemaker_boto_client, training_job_name):
tj = sagemaker_boto_client.describe_training_job(TrainingJobName=training_job_name)
source_arn = tj['TrainingJobArn']
Expand Down
1 change: 1 addition & 0 deletions tests/integ/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,4 @@ def test_list_trials(experiment_obj, trials):
assert set(trial_names) == set([s.trial_name for s in experiment_obj.list_trials()])
assert trial_names # sanity test


5 changes: 4 additions & 1 deletion tests/integ/test_trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ def test_list_sort(trials, sagemaker_boto_client):

def test_add_remove_trial_component(trial_obj, trial_component_obj):
trial_obj.add_trial_component(trial_component_obj)
trial_components = list(trial_obj.list_trial_components())
assert 1 == len(trial_components)
trial_obj.remove_trial_component(trial_component_obj)

trial_components = list(trial_obj.list_trial_components())
assert 0 == len(trial_components)

def test_save(trial_obj, sagemaker_boto_client):
trial_obj.display_name = 'foo'
Expand Down
15 changes: 15 additions & 0 deletions tests/integ/test_trial_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,18 @@ def test_list_sort(trial_components, sagemaker_boto_client):
trial_component_names_listed = trial_component_names_listed[::-1]
assert trial_component_names == trial_component_names_listed
assert trial_component_names # sanity test


def test_list_trial_components_by_experiment(experiment_obj, trial_component_obj, sagemaker_boto_client):
trial_obj = experiment_obj.create_trial()
trial_obj.add_trial_component(trial_component_obj)
trial_components = list(trial_component.TrialComponent.list(
sagemaker_boto_client=sagemaker_boto_client,
experiment_name=experiment_obj.experiment_name))
assert 1 == len(trial_components)
trial_obj.remove_trial_component(trial_component_obj)
trial_components = list(trial_component.TrialComponent.list(
sagemaker_boto_client=sagemaker_boto_client,
experiment_name=experiment_obj.experiment_name))
assert 0 == len(trial_components)
trial_obj.delete()

0 comments on commit 9d3b727

Please sign in to comment.