unparseable_filename = os.path.join(tmpdir, TEMP_DAG_FILENAME)
        with open(unparseable_filename, "w") as unparseable_file:
            unparseable_file.writelines(UNPARSEABLE_DAG_FILE_CONTENTS)
        with create_session() as session:
            self._process_file(unparseable_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 == unparseable_filename
            assert import_error.stacktrace == f"invalid syntax ({TEMP_DAG_FILENAME}, line 1)"
            session.rollback()
    @conf_vars({("core", "dagbag_import_error_tracebacks"): "False"})
    def test_add_unparseable_zip_file_creates_import_error(self, tmpdir):
        zip_filename = os.path.join(tmpdir, "test_zip.zip")
        invalid_dag_filename = os.path.join(zip_filename, TEMP_DAG_FILENAME)
        with ZipFile(zip_filename, "w") as zip_file:
            zip_file.writestr(TEMP_DAG_FILENAME, UNPARSEABLE_DAG_FILE_CONTENTS)
        with create_session() as session:
            self._process_file(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
            assert import_error.stacktrace == f"invalid syntax ({TEMP_DAG_FILENAME}, line 1)"
            session.rollback()
    @conf_vars({("core", "dagbag_import_error_tracebacks"): "False"})
    def test_dag_model_has_import_error_is_true_when_import_error_exists(self, tmpdir, session):