Skip to content

Commit 8c404b9

Browse files
author
Anandhi
committed
Adding start_date to test DAGs for 2.7 compatibility tests
1 parent 497bdba commit 8c404b9

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

tests/providers/openlineage/utils/test_utils.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ def test_get_task_groups_details_no_task_groups():
489489
@patch("airflow.providers.openlineage.conf.custom_run_facets", return_value=set())
490490
def test_get_custom_facets_with_no_function_definition(mock_custom_facet_funcs):
491491
sample_ti = TaskInstance(
492-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
492+
task=EmptyOperator(
493+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
494+
),
493495
state="running",
494496
)
495497
result = get_custom_facets(sample_ti)
@@ -502,7 +504,9 @@ def test_get_custom_facets_with_no_function_definition(mock_custom_facet_funcs):
502504
)
503505
def test_get_custom_facets_with_function_definition(mock_custom_facet_funcs):
504506
sample_ti = TaskInstance(
505-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
507+
task=EmptyOperator(
508+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
509+
),
506510
state="running",
507511
)
508512
result = get_custom_facets(sample_ti)
@@ -529,7 +533,11 @@ def test_get_custom_facets_with_function_definition(mock_custom_facet_funcs):
529533
)
530534
def test_get_custom_facets_with_return_value_as_none(mock_custom_facet_funcs):
531535
sample_ti = TaskInstance(
532-
task=BashOperator(task_id="test-task", bash_command="exit 0;", dag=DAG("test-dag")),
536+
task=BashOperator(
537+
task_id="test-task",
538+
bash_command="exit 0;",
539+
dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1)),
540+
),
533541
state="running",
534542
)
535543
result = get_custom_facets(sample_ti)
@@ -547,7 +555,9 @@ def test_get_custom_facets_with_return_value_as_none(mock_custom_facet_funcs):
547555
)
548556
def test_get_custom_facets_with_multiple_function_definition(mock_custom_facet_funcs):
549557
sample_ti = TaskInstance(
550-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
558+
task=EmptyOperator(
559+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
560+
),
551561
state="running",
552562
)
553563
result = get_custom_facets(sample_ti)
@@ -576,7 +586,9 @@ def test_get_custom_facets_with_multiple_function_definition(mock_custom_facet_f
576586
)
577587
def test_get_custom_facets_with_duplicate_facet_keys(mock_custom_facet_funcs):
578588
sample_ti = TaskInstance(
579-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
589+
task=EmptyOperator(
590+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
591+
),
580592
state="running",
581593
)
582594
result = get_custom_facets(sample_ti)
@@ -601,7 +613,9 @@ def test_get_custom_facets_with_duplicate_facet_keys(mock_custom_facet_funcs):
601613
)
602614
def test_get_custom_facets_with_invalid_function_definition(mock_custom_facet_funcs):
603615
sample_ti = TaskInstance(
604-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
616+
task=EmptyOperator(
617+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
618+
),
605619
state="running",
606620
)
607621
result = get_custom_facets(sample_ti)
@@ -614,7 +628,9 @@ def test_get_custom_facets_with_invalid_function_definition(mock_custom_facet_fu
614628
)
615629
def test_get_custom_facets_with_wrong_return_type_function(mock_custom_facet_funcs):
616630
sample_ti = TaskInstance(
617-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
631+
task=EmptyOperator(
632+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
633+
),
618634
state="running",
619635
)
620636
result = get_custom_facets(sample_ti)
@@ -627,7 +643,9 @@ def test_get_custom_facets_with_wrong_return_type_function(mock_custom_facet_fun
627643
)
628644
def test_get_custom_facets_with_exception(mock_custom_facet_funcs):
629645
sample_ti = TaskInstance(
630-
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
646+
task=EmptyOperator(
647+
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
648+
),
631649
state="running",
632650
)
633651
result = get_custom_facets(sample_ti)

0 commit comments

Comments
 (0)