Skip to content

Commit 5f21aa2

Browse files
author
pialidas
committed
fixed unit tests for py27 and integ test
1 parent 333cdbf commit 5f21aa2

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/sagemaker/automl/automl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def attach(cls, job_name, sagemaker_session=None):
117117

118118
_auto_ml_job_desc = sagemaker_session.describe_auto_ml_job(job_name)
119119
automl_job_tags = sagemaker_session.sagemaker_client.list_tags(
120-
_auto_ml_job_desc["AutoMLJobArn"]
121-
)
120+
ResourceArn=_auto_ml_job_desc["AutoMLJobArn"])["Tags"]
121+
122122
amlj = AutoML(
123123
role=_auto_ml_job_desc["RoleArn"],
124124
target_attribute_name=_auto_ml_job_desc["InputDataConfig"][0]["TargetAttributeName"],

tests/integ/test_auto_ml.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ def test_deploy_best_candidate(sagemaker_session, cpu_instance_type):
277277
sagemaker_session.sagemaker_client.delete_endpoint(EndpointName=endpoint_name)
278278

279279

280-
@pytest.mark.canary_quick
280+
@pytest.mark.skipif(
281+
tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS,
282+
reason="AutoML is not supported in the region yet.",
283+
)
281284
def test_create_model_best_candidate(sagemaker_session, cpu_instance_type):
282285
auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session)
283286

tests/unit/sagemaker/automl/test_auto_ml.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# language governing permissions and limitations under the License.
1313
from __future__ import absolute_import
1414

15+
import copy
16+
1517
import pytest
1618
from mock import Mock, patch
1719
from sagemaker import AutoML, AutoMLJob, AutoMLInput, CandidateEstimator, PipelineModel
@@ -600,7 +602,7 @@ def test_candidate_estimator_fit(sagemaker_session):
600602

601603

602604
def test_validate_and_update_inference_response():
603-
cic = CLASSIFICATION_INFERENCE_CONTAINERS.copy()
605+
cic = copy.copy(CLASSIFICATION_INFERENCE_CONTAINERS)
604606

605607
AutoML.validate_and_update_inference_response(
606608
inference_containers=cic,
@@ -622,7 +624,7 @@ def test_validate_and_update_inference_response():
622624

623625

624626
def test_validate_and_update_inference_response_wrong_input():
625-
cic = CLASSIFICATION_INFERENCE_CONTAINERS.copy()
627+
cic = copy.copy(CLASSIFICATION_INFERENCE_CONTAINERS)
626628

627629
with pytest.raises(
628630
ValueError,
@@ -661,4 +663,4 @@ def test_attach(sagemaker_session):
661663
assert aml.target_attribute_name == "y"
662664
assert aml.problem_type == "Auto"
663665
assert aml.output_path == "s3://output_prefix"
664-
assert aml.tags == LIST_TAGS_RESULT
666+
assert aml.tags == LIST_TAGS_RESULT["Tags"]

0 commit comments

Comments
 (0)