def METHOD_NAME(mocker, new_dir):
    def _fake_elf(name: str) -> ElfFile:
        Path(name).write_bytes(b"\x7fELF")
        if name.endswith("fake_elf-bad-patchelf"):
            with Path(name).open("ab") as f:
                f.write(b"nointerpreter")
        return ElfFile(path=Path(name))
    mocker.patch(
        "snapcraft.elf._elf_file.ElfFile._extract_attributes",
        new=_fake_elffile_extract_attributes,
    )
    yield _fake_elf