Skip to content

Commit

Permalink
fix static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpr91 committed Feb 10, 2022
1 parent b97f68a commit 18864ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 3 additions & 6 deletions airflow/providers/google/cloud/transfers/gcs_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ class GCSToGCSOperator(BaseOperator):
If set as a sequence, the identities from the list must grant
Service Account Token Creator IAM role to the directly preceding identity, with first
account from the list granting this role to the originating account (templated).
:param source_object_required: When source_object_required is True, if you want to copy / move a specific blob
and it doesn't exist, an exception is raised and the task is marked as failed.
This parameter doesn't have any effect when the source_object that you pass is a folder or pattern.
:param source_object_required: Whether you want to raise an exception when the source object
doesn't exist. It doesn't have any effect when the source objects are folders or patterns.
:Example:
Expand Down Expand Up @@ -319,9 +318,7 @@ def _copy_source_without_wildcard(self, hook, prefix):
hook=hook, source_object=prefix, destination_object=self.destination_object
)
elif self.source_object_required:
msg = (
f'{prefix} does not exist in bucket {self.source_bucket}'
)
msg = f"{prefix} does not exist in bucket {self.source_bucket}"
self.log.warning(msg)
raise AirflowException(msg)

Expand Down
5 changes: 2 additions & 3 deletions tests/providers/google/cloud/transfers/test_gcs_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,10 @@ def test_execute_source_object_required_flag_true(self, mock_hook):
source_objects=SOURCE_OBJECTS_SINGLE_FILE,
destination_bucket=DESTINATION_BUCKET,
destination_object=DESTINATION_OBJECT_PREFIX,
source_object_required=True
source_object_required=True,
)

with pytest.raises(
AirflowException,
match=f"{SOURCE_OBJECTS_SINGLE_FILE} does not exist in bucket {TEST_BUCKET}"
AirflowException, match=f"{SOURCE_OBJECTS_SINGLE_FILE} does not exist in bucket {TEST_BUCKET}"
):
operator.execute(None)

0 comments on commit 18864ed

Please sign in to comment.