filename_to_parse = os.path.join(tmpdir, TEMP_DAG_FILENAME)
        
        with open(filename_to_parse, "w") as file_to_parse:
            file_to_parse.writelines(UNPARSEABLE_DAG_FILE_CONTENTS)
        session = settings.Session()
        self._process_file(filename_to_parse, dag_directory=tmpdir, session=session)
        
        with open(filename_to_parse, "w") as file_to_parse:
            file_to_parse.writelines(PARSEABLE_DAG_FILE_CONTENTS)
        self._process_file(filename_to_parse, dag_directory=tmpdir, session=session)
        import_errors = session.query(errors.ImportError).all()
        assert len(import_errors) == 0
        session.rollback()
    def test_remove_error_clears_import_error_zip(self, tmpdir):
        session = settings.Session()
        
        zip_filename = os.path.join(tmpdir, "test_zip.zip")
        with ZipFile(zip_filename, "w") as zip_file:
            zip_file.writestr(TEMP_DAG_FILENAME, UNPARSEABLE_DAG_FILE_CONTENTS)
        self._process_file(zip_filename, dag_directory=tmpdir, session=session)
        import_errors = session.query(errors.ImportError).all()
        assert len(import_errors) == 1
        
        with ZipFile(zip_filename, "w") as zip_file:
            zip_file.writestr(TEMP_DAG_FILENAME, "import os # airflow DAG")
        self._process_file(zip_filename, dag_directory=tmpdir, session=session)
        import_errors = session.query(errors.ImportError).all()
        assert len(import_errors) == 0
        session.rollback()
    def test_import_error_tracebacks(self, tmpdir):