test_unix_socket fix

This commit is contained in:
bigtedde 2023-07-09 22:12:03 -04:00
parent 912df41c4a
commit 1e5c62f1a1
1 changed files with 3 additions and 2 deletions

View File

@ -175,8 +175,9 @@ def test_unix_socket(archivers, request, monkeypatch):
cmd(archiver, f"--repo={repo_location}", "rcreate", RK_ENCRYPTION)
try:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.bind(tempfile.mktemp(suffix="unix-socket", prefix="input"))
with tempfile.TemporaryDirectory(prefix="input") as temp_dir:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.bind(os.path.join(temp_dir, "unix-socket"))
except PermissionError as err:
if err.errno == errno.EPERM:
pytest.skip("unix sockets disabled or not supported")