vandonr-amz commented on code in PR #27453:
URL: https://github.com/apache/airflow/pull/27453#discussion_r1010952482
##########
tests/providers/amazon/aws/hooks/test_sagemaker.py:
##########
@@ -649,9 +623,8 @@ def test_training_with_logs(self, mock_describe,
mock_client, mock_log_client, m
assert mock_session.describe_training_job.call_count == 1
@mock.patch.object(SageMakerHook, "get_conn")
- def test_find_processing_job_by_name(self, mock_conn):
+ def test_find_processing_job_by_name(self, _):
Review Comment:
mock is necessary but default behavior doesn't need to be changed.
##########
tests/providers/amazon/aws/hooks/test_sagemaker.py:
##########
@@ -241,7 +241,7 @@
}
-class TestSageMakerHook(unittest.TestCase):
Review Comment:
`unittest.TestCase` is incompatible with `@pytest.mark.parametrize` which
I'm using below.
Given the fact that this inheritance was unnecessary, I simply removed it.
##########
tests/providers/amazon/aws/operators/test_sagemaker_model.py:
##########
@@ -46,40 +45,27 @@ class TestSageMakerModelOperator(unittest.TestCase):
def setUp(self):
self.sagemaker =
SageMakerModelOperator(task_id="test_sagemaker_operator",
config=CREATE_MODEL_PARAMS)
- @mock.patch.object(SageMakerHook, "get_conn")
+ @mock.patch.object(SageMakerHook, "describe_model", return_value="")
@mock.patch.object(SageMakerHook, "create_model")
- @mock.patch.object(sagemaker, "serialize", return_value="")
- def test_integer_fields(self, serialize, mock_model, mock_client):
- mock_model.return_value = {"ModelArn": "test_arn", "ResponseMetadata":
{"HTTPStatusCode": 200}}
+ def test_execute(self, mock_create_model, _):
+ mock_create_model.return_value = {"ModelArn": "test_arn",
"ResponseMetadata": {"HTTPStatusCode": 200}}
self.sagemaker.execute(None)
+ mock_create_model.assert_called_once_with(CREATE_MODEL_PARAMS)
assert self.sagemaker.integer_fields == EXPECTED_INTEGER_FIELDS
Review Comment:
merging 2 tests in one
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]