MCPcopy Create free account
hub / github.com/tox-dev/filelock / close

Function close

tests/conftest.py:72–77  ·  view source on GitHub ↗
(fd: int)

Source from the content-addressed store, hash-verified

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
74 # under test. An unrelated close inside a GC finalizer would escape as an unraisable exception.
75 if fd == locked_fd:
76 raise release_error
77 real_close(fd) # pragma: no cover # only an unrelated close (e.g. a GC finalizer) reaches here
78
79 yield capture, release_error, release_cause
80 if locked_fd is not None: # pragma: no branch # every consumer calls capture, so this is always set

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected