zip_filename = os.path.join(tmpdir, "test_zip.zip")
        with ZipFile(zip_filename, "w") as zip_file:
            zip_file.writestr(TEMP_DAG_FILENAME, PARSEABLE_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) == 0
            session.rollback()
    @conf_vars({("core", "dagbag_import_error_tracebacks"): "False"})
    def test_new_import_error_replaces_old(self, tmpdir):
        unparseable_filename = os.path.join(tmpdir, TEMP_DAG_FILENAME)
        
        with open(unparseable_filename, "w") as unparseable_file:
            unparseable_file.writelines(UNPARSEABLE_DAG_FILE_CONTENTS)
        session = settings.Session()
        self._process_file(unparseable_filename, dag_directory=tmpdir, session=session)
        
        with open(unparseable_filename, "w") as unparseable_file:
            unparseable_file.writelines(
                PARSEABLE_DAG_FILE_CONTENTS + os.linesep + UNPARSEABLE_DAG_FILE_CONTENTS
            )
        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 2)"
        session.rollback()
    def test_import_error_record_is_updated_not_deleted_and_recreated(self, tmpdir):