Dev-iL commented on code in PR #74817:
URL: https://github.com/apache/airflow/pull/74817#discussion_r4307062645


##########
providers/amazon/tests/unit/amazon/aws/transfers/test_sql_to_s3.py:
##########
@@ -199,6 +199,41 @@ def test_fix_dtypes_not_called(self, mock_s3_hook):
 
         mock_fix_dtypes.assert_not_called()
 
+    @pytest.mark.parametrize(
+        ("df_type", "file_format", "read_kwargs", "available_engines", 
"should_raise"),
+        [
+            pytest.param("pandas", "parquet", {}, set(), True, 
id="pandas-parquet-no-engine"),
+            pytest.param("pandas", "parquet", {}, {"fastparquet"}, False, 
id="pandas-parquet-fastparquet"),
+            pytest.param(
+                "pandas", "csv", {"dtype_backend": "pyarrow"}, set(), True, 
id="pandas-pyarrow-backend"
+            ),
+            pytest.param("pandas", "csv", {}, set(), False, 
id="pandas-csv-no-engine"),
+            pytest.param("polars", "parquet", {}, set(), False, 
id="polars-parquet-no-engine"),
+        ],
+    )
+    @mock.patch("importlib.util.find_spec")

Review Comment:
   Added `autospec=True`. The process-wide point turned out to matter more than 
the signature: the patch is live while the operator is constructed and 
`execute()` runs, so a stub answering `None` for every name also answers 
optional-dependency probes these tests say nothing about, and a test could then 
pass for the wrong reason.
   
   The stub now fakes only `pyarrow` and `fastparquet` and delegates every 
other name to the real `find_spec`, captured at module import before any 
patching. Its signature is `(name, package=None)` to match the stdlib, which is 
what `autospec=True` enforces.
   
   ---
   Drafted-by: Claude Code (Opus 5) (no human review before posting)



-- 
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]

Reply via email to