Skip to content

Commit

Permalink
Use a shorter temporary directory name for AF_UNIX sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
njsmith committed Aug 11, 2017
1 parent 3300d6d commit 2c62a56
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions trio/tests/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import time
from math import inf
import tempfile

import pytest

Expand Down Expand Up @@ -776,7 +777,7 @@ async def two_way_stream_maker():
await check_two_way_stream(two_way_stream_maker, two_way_stream_maker)


async def test_open_stream_to_socket_listener(tmpdir):
async def test_open_stream_to_socket_listener():
async def check(listener):
async with listener:
client_stream = await open_stream_to_socket_listener(listener)
Expand Down Expand Up @@ -807,7 +808,10 @@ async def check(listener):
if hasattr(tsocket, "AF_UNIX"):
# Listener bound to Unix-domain socket
sock = tsocket.socket(family=tsocket.AF_UNIX)
path = str(tmpdir / "sock")
sock.bind(path)
sock.listen(10)
await check(SocketListener(sock))
# can't use pytest's tmpdir; if we try then MacOS says "OSError:
# AF_UNIX path too long"
with tempfile.TemporaryDirectory() as tmpdir:
path = "{}/sock".format(tmpdir)
sock.bind(path)
sock.listen(10)
await check(SocketListener(sock))

0 comments on commit 2c62a56

Please sign in to comment.