MCPcopy
hub / github.com/python-trio/trio / test_windows_functionality

Function test_windows_functionality

src/trio/_tests/test_fakenet.py:200–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198 reason="windows-specific fakesocket testing",
199)
200async def test_windows_functionality() -> None:
201 # mypy doesn't support a good way of aborting typechecking on different platforms
202 if sys.platform == "win32": # pragma: no branch
203 fn()
204 s1 = trio.socket.socket(type=trio.socket.SOCK_DGRAM)
205 s2 = trio.socket.socket(type=trio.socket.SOCK_DGRAM)
206 await s1.bind(("127.0.0.1", 0))
207 with pytest.raises(
208 AttributeError,
209 match=r"^'FakeSocket' object has no attribute 'sendmsg'$",
210 ):
211 await s1.sendmsg([b"jkl"], (), 0, s2.getsockname()) # type: ignore[attr-defined]
212 with pytest.raises(
213 AttributeError,
214 match=r"^'FakeSocket' object has no attribute 'recvmsg'$",
215 ):
216 s2.recvmsg(0) # type: ignore[attr-defined]
217 with pytest.raises(
218 AttributeError,
219 match=r"^'FakeSocket' object has no attribute 'recvmsg_into'$",
220 ):
221 s2.recvmsg_into([]) # type: ignore[attr-defined]
222 with pytest.raises(NotImplementedError):
223 s1.share(0)
224
225
226async def test_basic_tcp() -> None:

Callers

nothing calls this directly

Calls 8

fnFunction · 0.70
socketMethod · 0.45
bindMethod · 0.45
sendmsgMethod · 0.45
getsocknameMethod · 0.45
recvmsgMethod · 0.45
recvmsg_intoMethod · 0.45
shareMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…