You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ja...@apache.org on 2025/09/26 12:27:07 UTC

(airflow) branch main updated: Enable PT011 rule to prvoider tests (#56087)

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

jasonliu 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 3cf09faba42 Enable PT011 rule to prvoider tests (#56087)
3cf09faba42 is described below

commit 3cf09faba4254923a449bb3be5edbcf3bcf11481
Author: Xch1 <34...@users.noreply.github.com>
AuthorDate: Fri Sep 26 20:26:59 2025 +0800

    Enable PT011 rule to prvoider tests (#56087)
    
    * modify test_base_google
    
    Signed-off-by: Xch1 <qc...@gmail.com>
    
    * modify test_mlengine_prediction_summary
    
    Signed-off-by: Xch1 <qc...@gmail.com>
    
    * modify test_helpers
    
    Signed-off-by: Xch1 <qc...@gmail.com>
    
    * modify test_datafusion
    
    Signed-off-by: Xch1 <qc...@gmail.com>
    
    * modify test_local_to_gcs
    
    Signed-off-by: Xch1 <qc...@gmail.com>
    
    ---------
    
    Signed-off-by: Xch1 <qc...@gmail.com>
---
 .../google/tests/unit/google/cloud/transfers/test_local_to_gcs.py     | 2 +-
 providers/google/tests/unit/google/cloud/utils/test_datafusion.py     | 2 +-
 providers/google/tests/unit/google/cloud/utils/test_helpers.py        | 2 +-
 .../tests/unit/google/cloud/utils/test_mlengine_prediction_summary.py | 2 +-
 providers/google/tests/unit/google/common/hooks/test_base_google.py   | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/providers/google/tests/unit/google/cloud/transfers/test_local_to_gcs.py b/providers/google/tests/unit/google/cloud/transfers/test_local_to_gcs.py
index 8142ebaa18b..d6154bf3751 100644
--- a/providers/google/tests/unit/google/cloud/transfers/test_local_to_gcs.py
+++ b/providers/google/tests/unit/google/cloud/transfers/test_local_to_gcs.py
@@ -172,7 +172,7 @@ class TestFileToGcsOperator:
             dst=dst,
             **self._config,
         )
-        with pytest.raises(ValueError):
+        with pytest.raises(ValueError, match="'dst' parameter references filepath."):
             operator.execute(None)
         mock_instance.assert_not_called()
 
diff --git a/providers/google/tests/unit/google/cloud/utils/test_datafusion.py b/providers/google/tests/unit/google/cloud/utils/test_datafusion.py
index ab1f3a0927e..bacf40e3509 100644
--- a/providers/google/tests/unit/google/cloud/utils/test_datafusion.py
+++ b/providers/google/tests/unit/google/cloud/utils/test_datafusion.py
@@ -33,5 +33,5 @@ class TestDataFusionPipelineType:
         assert DataFusionPipelineType.from_str(str_value) == expected_item
 
     def test_from_str_error(self):
-        with pytest.raises(ValueError):
+        with pytest.raises(ValueError, match="Invalid value 'non-existing value'."):
             DataFusionPipelineType.from_str("non-existing value")
diff --git a/providers/google/tests/unit/google/cloud/utils/test_helpers.py b/providers/google/tests/unit/google/cloud/utils/test_helpers.py
index c277b8470bb..9c603a6692d 100644
--- a/providers/google/tests/unit/google/cloud/utils/test_helpers.py
+++ b/providers/google/tests/unit/google/cloud/utils/test_helpers.py
@@ -39,5 +39,5 @@ class TestHelpers:
         assert resource_path_to_dict(resource_name=resource_name) == expected_dict
 
     def test_resource_path_to_dict_fail(self):
-        with pytest.raises(ValueError):
+        with pytest.raises(ValueError, match="Invalid resource_name."):
             resource_path_to_dict(resource_name="key/value/key")
diff --git a/providers/google/tests/unit/google/cloud/utils/test_mlengine_prediction_summary.py b/providers/google/tests/unit/google/cloud/utils/test_mlengine_prediction_summary.py
index 8697f32c7b0..c152c56ba03 100644
--- a/providers/google/tests/unit/google/cloud/utils/test_mlengine_prediction_summary.py
+++ b/providers/google/tests/unit/google/cloud/utils/test_mlengine_prediction_summary.py
@@ -77,7 +77,7 @@ class TestMakeSummary:
         non_callable_value = 1
         fn_enc = base64.b64encode(dill.dumps(non_callable_value)).decode("utf-8")
 
-        with pytest.raises(ValueError):
+        with pytest.raises(ValueError, match="--metric_fn_encoded must be an encoded callable."):
             mlengine_prediction_summary.run(
                 [
                     "--prediction_path=some/path",
diff --git a/providers/google/tests/unit/google/common/hooks/test_base_google.py b/providers/google/tests/unit/google/common/hooks/test_base_google.py
index f3055907c67..2a1daeaef0a 100644
--- a/providers/google/tests/unit/google/common/hooks/test_base_google.py
+++ b/providers/google/tests/unit/google/common/hooks/test_base_google.py
@@ -121,9 +121,9 @@ class TestRefreshCredentialsRetry:
     def test_raise_non_refresh_error(self):
         @hook.GoogleBaseHook.refresh_credentials_retry()
         def func():
-            raise ValueError()
+            raise ValueError("This is a test ValueError.")
 
-        with pytest.raises(ValueError):
+        with pytest.raises(ValueError, match="This is a test ValueError."):
             func()
 
     @mock.patch("tenacity.nap.time.sleep", mock.MagicMock())