Skip to content

Commit

Permalink
Add test for when callback is not called
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana committed Sep 26, 2023
1 parent eff6adc commit e97d6f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/operators/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,31 @@ def test_run_test_operator_with_callback(failing_test_dbt_project):
assert on_warning_callback.called


@pytest.mark.integration
def test_run_test_operator_without_callback():
on_warning_callback = MagicMock()

with DAG("test-id-3", start_date=datetime(2022, 1, 1)) as dag:
run_operator = DbtRunLocalOperator(
profile_config=real_profile_config,
project_dir=DBT_PROJ_DIR,
task_id="run",
dbt_cmd_flags=["--models", "orders"],
install_deps=True,
)
test_operator = DbtTestLocalOperator(
profile_config=real_profile_config,
project_dir=DBT_PROJ_DIR,
task_id="test",
dbt_cmd_flags=["--models", "orders"],
install_deps=True,
exclude="relationships_orders_customer_id__customer_id__ref_customers_",
)
run_operator >> test_operator
run_test_dag(dag)
assert not on_warning_callback.called


@pytest.mark.integration
def test_run_operator_emits_events():
class MockRun:
Expand Down

0 comments on commit e97d6f4

Please sign in to comment.