This is an automated email from the ASF dual-hosted git repository.
eladkal 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 8df6a569527 Flattening the `requirements` input for python venv
operators (#50521)
8df6a569527 is described below
commit 8df6a569527a6bea5630439cbaaab75992b7df2d
Author: Amogh Desai <[email protected]>
AuthorDate: Tue May 13 13:33:41 2025 +0530
Flattening the `requirements` input for python venv operators (#50521)
* Flattening the requirements for python virtual env operator
* Refine BigQuery test with field-wise comparison of access_entries
---
providers/google/tests/unit/google/cloud/hooks/test_bigquery.py | 7 ++++++-
.../standard/src/airflow/providers/standard/operators/python.py | 9 ++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/providers/google/tests/unit/google/cloud/hooks/test_bigquery.py
b/providers/google/tests/unit/google/cloud/hooks/test_bigquery.py
index c6a10815fbd..8d51cf4b7ea 100644
--- a/providers/google/tests/unit/google/cloud/hooks/test_bigquery.py
+++ b/providers/google/tests/unit/google/cloud/hooks/test_bigquery.py
@@ -323,7 +323,12 @@ class TestBigQueryHookMethods(_BigQueryBaseTestClass):
)
mock_get.assert_called_once_with(project_id=PROJECT_ID,
dataset_id=DATASET_ID)
- assert view_access in dataset.access_entries
+ assert any(
+ entry.role == view_access.role
+ and entry.entity_type == view_access.entity_type
+ and entry.entity_id == view_access.entity_id
+ for entry in dataset.access_entries
+ ), f"View access entry not found in {dataset.access_entries}"
mock_update.assert_called_once_with(
fields=["access"],
dataset_resource=dataset.to_api_repr(),
diff --git
a/providers/standard/src/airflow/providers/standard/operators/python.py
b/providers/standard/src/airflow/providers/standard/operators/python.py
index 37aa79c3343..01e184d924b 100644
--- a/providers/standard/src/airflow/providers/standard/operators/python.py
+++ b/providers/standard/src/airflow/providers/standard/operators/python.py
@@ -859,7 +859,14 @@ class
PythonVirtualenvOperator(_BasePythonVirtualenvOperator):
# If we're using system packages, assume both are present
found_airflow = found_pendulum = True
else:
- for raw_str in self.requirements:
+ requirements_iterable = []
+ if isinstance(self.requirements, str):
+ requirements_iterable = self.requirements.splitlines()
+ else:
+ for item in self.requirements:
+ requirements_iterable.extend(item.splitlines())
+
+ for raw_str in requirements_iterable:
line = raw_str.strip()
# Skip blank lines and fullāline comments
if not line or line.startswith("#"):