self, mock_send_email, mock_stats_incr, create_dummy_dag
    ):
        """
        Test that the dag file processor gracefully logs an exception if there is a problem
        sending an email
        """
        session = settings.Session()
        
        mock_send_email.side_effect = RuntimeError("Could not send an email")
        test_start_date = timezone.utcnow() - datetime.timedelta(days=1)
        dag, task = create_dummy_dag(
            dag_id="test_sla_miss",
            task_id="dummy",
            email="test@test.com",
            default_args={"start_date": test_start_date, "sla": datetime.timedelta(hours=1)},
        )
        mock_stats_incr.reset_mock()
        session.merge(TaskInstance(task=task, execution_date=test_start_date, state="Success"))
        
        session.merge(SlaMiss(task_id="dummy", dag_id="test_sla_miss", execution_date=test_start_date))
        mock_log = mock.MagicMock()
        dag_file_processor = DagFileProcessor(dag_ids=[], dag_directory=TEST_DAGS_FOLDER, log=mock_log)
        dag_file_processor.manage_slas(dag=dag, session=session)
        mock_log.exception.assert_called_once_with(
            "Could not send SLA Miss email notification for DAG %s", "test_sla_miss"
        )
        mock_stats_incr.assert_called_once_with(
            "sla_email_notification_failure", tags={"dag_id": "test_sla_miss"}
        )
    def test_dag_file_processor_sla_miss_deleted_task(self, create_dummy_dag):