def METHOD_NAME(self):
    if self.home_is_temp:
        # Verify that no files were written to a literal tilde path
        for temp_file, temp_file_no_tilde in self.temp_files_used:
            assert not os.path.exists(temp_file)
            assert os.path.exists(temp_file_no_tilde)
    if hasattr(self, "temp_dir") and os.path.exists(self.temp_dir):
        tries = 3
        while tries:
            try:
                shutil.rmtree(self.temp_dir)
                break
            except OSError:
                # Probably couldn't delete the file because for whatever
                # reason a handle to it is still open/hasn't been
                # garbage-collected
                time.sleep(0.5)
                tries -= 1
    fits.conf.reset("enable_record_valued_keyword_cards")
    fits.conf.reset("extension_name_case_sensitive")
    fits.conf.reset("strip_header_whitespace")
    fits.conf.reset("use_memmap")