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

Function test_fromshare

src/trio/_tests/test_socket.py:345–356  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

343
344@pytest.mark.skipif(not hasattr(tsocket, "fromshare"), reason="windows only")
345async def test_fromshare() -> None:
346 if TYPE_CHECKING and sys.platform != "win32": # pragma: no cover
347 return
348 a, b = tsocket.socketpair()
349 with a, b:
350 # share with ourselves
351 shared = a.share(os.getpid())
352 a2 = tsocket.fromshare(shared)
353 with a2:
354 assert a.fileno() != a2.fileno()
355 await a2.send(b"x")
356 assert await b.recv(1) == b"x"
357
358
359async def test_socket() -> None:

Callers

nothing calls this directly

Calls 4

shareMethod · 0.45
filenoMethod · 0.45
sendMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…