Skip to content

Commit

Permalink
Adding start_date to test DAGs for 2.7 compatibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anandhi committed Jul 18, 2024
1 parent 497bdba commit 8c404b9
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions tests/providers/openlineage/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ def test_get_task_groups_details_no_task_groups():
@patch("airflow.providers.openlineage.conf.custom_run_facets", return_value=set())
def test_get_custom_facets_with_no_function_definition(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand All @@ -502,7 +504,9 @@ def test_get_custom_facets_with_no_function_definition(mock_custom_facet_funcs):
)
def test_get_custom_facets_with_function_definition(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand All @@ -529,7 +533,11 @@ def test_get_custom_facets_with_function_definition(mock_custom_facet_funcs):
)
def test_get_custom_facets_with_return_value_as_none(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=BashOperator(task_id="test-task", bash_command="exit 0;", dag=DAG("test-dag")),
task=BashOperator(
task_id="test-task",
bash_command="exit 0;",
dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1)),
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand All @@ -547,7 +555,9 @@ def test_get_custom_facets_with_return_value_as_none(mock_custom_facet_funcs):
)
def test_get_custom_facets_with_multiple_function_definition(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand Down Expand Up @@ -576,7 +586,9 @@ def test_get_custom_facets_with_multiple_function_definition(mock_custom_facet_f
)
def test_get_custom_facets_with_duplicate_facet_keys(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand All @@ -601,7 +613,9 @@ def test_get_custom_facets_with_duplicate_facet_keys(mock_custom_facet_funcs):
)
def test_get_custom_facets_with_invalid_function_definition(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand All @@ -614,7 +628,9 @@ def test_get_custom_facets_with_invalid_function_definition(mock_custom_facet_fu
)
def test_get_custom_facets_with_wrong_return_type_function(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand All @@ -627,7 +643,9 @@ def test_get_custom_facets_with_wrong_return_type_function(mock_custom_facet_fun
)
def test_get_custom_facets_with_exception(mock_custom_facet_funcs):
sample_ti = TaskInstance(
task=EmptyOperator(task_id="test-task", dag=DAG("test-dag")),
task=EmptyOperator(
task_id="test-task", dag=DAG("test-dag", start_date=datetime.datetime(2024, 7, 1))
),
state="running",
)
result = get_custom_facets(sample_ti)
Expand Down

0 comments on commit 8c404b9

Please sign in to comment.