This is an automated email from the ASF dual-hosted git repository.
jscheffl 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 25342fad58 Adding session fixture into
create_task_instance_of_operator (#41317)
25342fad58 is described below
commit 25342fad58d44db25149495aabe17d7184f1846b
Author: Bugra Ozturk <[email protected]>
AuthorDate: Wed Aug 7 23:12:50 2024 +0200
Adding session fixture into create_task_instance_of_operator (#41317)
---
tests/providers/cncf/kubernetes/operators/test_pod.py | 1 +
.../cncf/kubernetes/operators/test_spark_kubernetes.py | 11 +++++++++--
tests/providers/common/io/xcom/test_backend.py | 3 ++-
tests/providers/databricks/operators/test_databricks_copy.py | 1 +
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/tests/providers/cncf/kubernetes/operators/test_pod.py
b/tests/providers/cncf/kubernetes/operators/test_pod.py
index cf1aa8864e..fd01a3e495 100644
--- a/tests/providers/cncf/kubernetes/operators/test_pod.py
+++ b/tests/providers/cncf/kubernetes/operators/test_pod.py
@@ -139,6 +139,7 @@ class TestKubernetesPodOperator:
dag_id = "TestKubernetesPodOperator"
ti = create_task_instance_of_operator(
KubernetesPodOperator,
+ session=session,
dag_id=dag_id,
task_id="task-id",
namespace="{{ dag.dag_id }}",
diff --git a/tests/providers/cncf/kubernetes/operators/test_spark_kubernetes.py
b/tests/providers/cncf/kubernetes/operators/test_spark_kubernetes.py
index 46d133918c..2ae5e5f1a9 100644
--- a/tests/providers/cncf/kubernetes/operators/test_spark_kubernetes.py
+++ b/tests/providers/cncf/kubernetes/operators/test_spark_kubernetes.py
@@ -554,6 +554,7 @@ def
test_template_body_templating(create_task_instance_of_operator, session):
kubernetes_conn_id="kubernetes_default_kube_config",
dag_id="test_template_body_templating_dag",
task_id="test_template_body_templating_task",
+ session=session,
execution_date=timezone.datetime(2024, 2, 1, tzinfo=timezone.utc),
)
session.add(ti)
@@ -570,7 +571,9 @@ def test_resolve_application_file_template_file(dag_maker,
tmp_path, session):
(tmp_path / filename).write_text("foo: {{ ds }}\nbar: {{ dag_run.dag_id
}}\nspam: egg")
with dag_maker(
- dag_id="test_resolve_application_file_template_file",
template_searchpath=tmp_path.as_posix()
+ dag_id="test_resolve_application_file_template_file",
+ template_searchpath=tmp_path.as_posix(),
+ session=session,
):
SparkKubernetesOperator(
application_file=filename,
@@ -609,7 +612,9 @@ def
test_resolve_application_file_template_non_dictionary(dag_maker, tmp_path, b
yaml.safe_dump(body, fp)
with dag_maker(
- dag_id="test_resolve_application_file_template_nondictionary",
template_searchpath=tmp_path.as_posix()
+ dag_id="test_resolve_application_file_template_nondictionary",
+ template_searchpath=tmp_path.as_posix(),
+ session=session,
):
SparkKubernetesOperator(
application_file=filename,
@@ -654,6 +659,7 @@ def test_resolve_application_file_real_file(
kubernetes_conn_id="kubernetes_default_kube_config",
dag_id="test_resolve_application_file_real_file",
task_id="test_template_body_templating_task",
+ session=session,
)
session.add(ti)
session.commit()
@@ -677,6 +683,7 @@ def
test_resolve_application_file_real_file_not_exists(create_task_instance_of_o
kubernetes_conn_id="kubernetes_default_kube_config",
dag_id="test_resolve_application_file_real_file_not_exists",
task_id="test_template_body_templating_task",
+ session=session,
)
session.add(ti)
session.commit()
diff --git a/tests/providers/common/io/xcom/test_backend.py
b/tests/providers/common/io/xcom/test_backend.py
index 23f9138e0f..b0516ad487 100644
--- a/tests/providers/common/io/xcom/test_backend.py
+++ b/tests/providers/common/io/xcom/test_backend.py
@@ -65,12 +65,13 @@ def reset_cache():
@pytest.fixture
-def task_instance(create_task_instance_of_operator):
+def task_instance(create_task_instance_of_operator, session):
return create_task_instance_of_operator(
EmptyOperator,
dag_id="test-dag-id",
task_id="test-task-id",
execution_date=timezone.datetime(2021, 12, 3, 4, 56),
+ session=session,
)
diff --git a/tests/providers/databricks/operators/test_databricks_copy.py
b/tests/providers/databricks/operators/test_databricks_copy.py
index 7c498eab48..b03309acbd 100644
--- a/tests/providers/databricks/operators/test_databricks_copy.py
+++ b/tests/providers/databricks/operators/test_databricks_copy.py
@@ -245,6 +245,7 @@ def test_templating(create_task_instance_of_operator,
session):
dag_id="test_template_body_templating_dag",
task_id="test_template_body_templating_task",
execution_date=timezone.datetime(2024, 2, 1, tzinfo=timezone.utc),
+ session=session,
)
session.add(ti)
session.commit()