(fd: int)
| 65 | real_close = os.close |
| 66 | |
| 67 | def capture(fd: int) -> None: |
| 68 | nonlocal locked_fd |
| 69 | locked_fd = fd |
| 70 | mocker.patch("filelock._api.os.close", side_effect=close) |
| 71 | |
| 72 | def close(fd: int) -> None: |
| 73 | # filelock._api.os is the os module, so this patches os.close process-wide. Raise only for the descriptor |