()
| 328 | |
| 329 | |
| 330 | def _dropped_instances_script() -> str: # pragma: needs fd-directory |
| 331 | return textwrap.dedent( |
| 332 | """ |
| 333 | from __future__ import annotations |
| 334 | |
| 335 | import gc |
| 336 | import sys |
| 337 | from pathlib import Path |
| 338 | |
| 339 | from filelock import ReadWriteLock |
| 340 | |
| 341 | root = Path(sys.argv[1]) |
| 342 | descriptor_path = Path("/dev/fd") if Path("/dev/fd").is_dir() else Path("/proc/self/fd") |
| 343 | gc.collect() |
| 344 | initial_count = sum(1 for _ in descriptor_path.iterdir()) |
| 345 | for index in range(100): |
| 346 | lock = ReadWriteLock(root / f"dropped-{index}.db", is_singleton=False) |
| 347 | lock.acquire_write() |
| 348 | del lock |
| 349 | gc.collect() |
| 350 | |
| 351 | assert sum(1 for _ in descriptor_path.iterdir()) == initial_count |
| 352 | with ReadWriteLock(root / "dropped-0.db", is_singleton=False).read_lock(): |
| 353 | pass |
| 354 | """ |
| 355 | ) |
| 356 | |
| 357 | |
| 358 | def _reentrant_finalizer_script() -> str: # pragma: needs fork |
no outgoing calls
no test coverage detected