shahar1 commented on code in PR #70723:
URL: https://github.com/apache/airflow/pull/70723#discussion_r3693625968


##########
providers/amazon/tests/unit/amazon/aws/transfers/test_gcs_to_s3.py:
##########
@@ -75,6 +75,18 @@ def test_execute__match_glob(self, mock_hook):
                 user_project=None,
             )
 
+    @mock.patch("airflow.providers.google.__version__", "10.2.0")
+    def test_match_glob_requires_recent_google_provider(self):
+        with pytest.raises(ValueError, match="match_glob"):
+            GCSToS3Operator(
+                task_id=TASK_ID,
+                gcs_bucket=GCS_BUCKET,
+                prefix=PREFIX,
+                dest_aws_conn_id="aws_default",
+                dest_s3_key=S3_BUCKET,
+                match_glob=f"**/*{DELIMITER}",
+            )

Review Comment:
   The test passes `match_glob=f"**/*{DELIMITER}"`, which is truthy, so it 
would still pass against the old `if not ... and match_glob:` condition — the 
only thing failing it on `main` is the `AirflowException` → `ValueError` swap, 
not the polarity change. Since `is not None` vs. truthiness was the substance 
of the review round, worth parametrising so the empty-string case is pinned:
   
   ```suggestion
       @mock.patch("airflow.providers.google.__version__", "10.2.0")
       @pytest.mark.parametrize("match_glob", [f"**/*{DELIMITER}", ""])
       def test_match_glob_requires_recent_google_provider(self, match_glob):
           with pytest.raises(ValueError, match="match_glob"):
               GCSToS3Operator(
                   task_id=TASK_ID,
                   gcs_bucket=GCS_BUCKET,
                   prefix=PREFIX,
                   dest_aws_conn_id="aws_default",
                   dest_s3_key=S3_BUCKET,
                   match_glob=match_glob,
               )
   ```
   
   `AGENTS.md` asks for `@pytest.mark.parametrize` when tests differ only in 
input, so this stays one test rather than two.
   



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