()
| 343 | |
| 344 | @pytest.mark.skipif(not hasattr(tsocket, "fromshare"), reason="windows only") |
| 345 | async 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 | |
| 359 | async def test_socket() -> None: |