invalid_zip_filename = os.path.join(tmpdir, "test_zip_invalid.zip")
        invalid_dag_filename = os.path.join(invalid_zip_filename, TEMP_DAG_FILENAME)
        with ZipFile(invalid_zip_filename, "w") as invalid_zip_file:
            invalid_zip_file.writestr(TEMP_DAG_FILENAME, INVALID_DAG_WITH_DEPTH_FILE_CONTENTS)
        with create_session() as session:
            self._process_file(invalid_zip_filename, dag_directory=tmpdir, session=session)
            import_errors = session.query(errors.ImportError).all()
            assert len(import_errors) == 1
            import_error = import_errors[0]
            assert import_error.filename == invalid_dag_filename
            expected_stacktrace = (
                "Traceback (most recent call last):\n"
                '  File "{}", line 2, in something\n'
                "    return airflow_DAG\n"
                "NameError: name 'airflow_DAG' is not defined\n"
            )
            assert import_error.stacktrace == expected_stacktrace.format(invalid_dag_filename)
            session.rollback()
    @conf_vars({("logging", "dag_processor_log_target"): "stdout"})
    @mock.patch("airflow.dag_processing.processor.settings.dispose_orm", MagicMock)
    @mock.patch("airflow.dag_processing.processor.redirect_stdout")
    def test_dag_parser_output_when_logging_to_stdout(self, mock_redirect_stdout_for_file):