| 235 | |
| 236 | @pytest.fixture |
| 237 | def lock_path_in_shared_tmp() -> Iterator[Path]: # pragma: needs foreign-sticky-tmp |
| 238 | # /tmp itself, where every account can create names, rather than this test's own directory. |
| 239 | lock_path = Path("/tmp", f"filelock-{secrets.token_hex(8)}.lock") # ruff:ignore[hardcoded-temp-file] # the subject |
| 240 | yield lock_path |
| 241 | for derived in (Path(f"{lock_path}.filelock"), Path(f"{lock_path}.rw")): |
| 242 | shutil.rmtree(derived, ignore_errors=True) |
| 243 | lock_path.unlink(missing_ok=True) |
| 244 | |
| 245 | |
| 246 | @pytest.fixture |