This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 935c8b9702a Fix SageMaker delete model compat test to handle moto 
status code change (#66473)
935c8b9702a is described below

commit 935c8b9702ab28c18a6efe1587a3c4058801eae7
Author: Amogh Desai <[email protected]>
AuthorDate: Thu May 7 00:37:04 2026 +0530

    Fix SageMaker delete model compat test to handle moto status code change 
(#66473)
    
    * Fix SageMaker delete model compat test to handle moto status code change
    
    moto changed the HTTP status code returned for DeleteModel on a
    non-existent model from 404 to 400 across versions. Accept both codes
    so the test passes against Airflow 3.2.1 compat environments.
    
    * Add comment explaining moto status code compat in delete model test
---
 providers/amazon/tests/unit/amazon/aws/hooks/test_sagemaker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/providers/amazon/tests/unit/amazon/aws/hooks/test_sagemaker.py 
b/providers/amazon/tests/unit/amazon/aws/hooks/test_sagemaker.py
index 01b7e51f6a3..1aa3a34d112 100644
--- a/providers/amazon/tests/unit/amazon/aws/hooks/test_sagemaker.py
+++ b/providers/amazon/tests/unit/amazon/aws/hooks/test_sagemaker.py
@@ -703,7 +703,8 @@ class TestSageMakerHook:
             hook.delete_model(model_name="test")
         ex = raised_exception.value
         assert ex.operation_name == "DeleteModel"
-        assert ex.response["ResponseMetadata"]["HTTPStatusCode"] == 404
+        # moto changed from 404 to 400 (matching real AWS) in newer versions; 
accept both for compat
+        assert ex.response["ResponseMetadata"]["HTTPStatusCode"] in (400, 404)
 
     @patch("airflow.providers.amazon.aws.hooks.sagemaker.SageMakerHook.conn", 
new_callable=mock.PropertyMock)
     def test_start_pipeline_returns_arn(self, mock_conn):

Reply via email to