(path: str, flags: int, mode: int = 0o777, *, dir_fd: int | None = None)
| 1075 | real_open = os.open |
| 1076 | |
| 1077 | def open_always_permission_error(path: str, flags: int, mode: int = 0o777, *, dir_fd: int | None = None) -> int: |
| 1078 | if "test.lock" in path: |
| 1079 | raise PermissionError(13, "Permission denied", path) |
| 1080 | return real_open(path, flags, mode) if dir_fd is None else real_open(path, flags, mode, dir_fd=dir_fd) |
| 1081 | |
| 1082 | mocker.patch("os.open", side_effect=open_always_permission_error) |
| 1083 | with pytest.raises(PermissionError, match="Permission denied"): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…