summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-17 11:16:51 (GMT)
committerGitHub <noreply@github.com>2022-06-17 11:16:51 (GMT)
commitc5b750dc0b4d4e58047c9d93c635fa26b06562f7 (patch)
treea3a1701db431c87b54036b0f890dcf5c4a4230dd /Lib/test/test_asyncio/utils.py
parentffc228dd4e409336f2c2ad54125de384bf1a767b (diff)
downloadcpython-c5b750dc0b4d4e58047c9d93c635fa26b06562f7.zip
cpython-c5b750dc0b4d4e58047c9d93c635fa26b06562f7.tar.gz
cpython-c5b750dc0b4d4e58047c9d93c635fa26b06562f7.tar.bz2
gh-93852: Add test.support.create_unix_domain_name() (#93914)
test_asyncio, test_logging, test_socket and test_socketserver now create AF_UNIX domains in the current directory to no longer fail with OSError("AF_UNIX path too long") if the temporary directory (the TMPDIR environment variable) is too long. Modify the following tests to use create_unix_domain_name(): * test_asyncio * test_logging * test_socket * test_socketserver test_asyncio.utils: remove unused time import.
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 507daa1..96be5a1 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -11,9 +11,7 @@ import selectors
import socket
import socketserver
import sys
-import tempfile
import threading
-import time
import unittest
import weakref
@@ -34,6 +32,7 @@ from asyncio import futures
from asyncio import tasks
from asyncio.log import logger
from test import support
+from test.support import socket_helper
from test.support import threading_helper
@@ -251,8 +250,7 @@ if hasattr(socket, 'AF_UNIX'):
def gen_unix_socket_path():
- with tempfile.NamedTemporaryFile() as file:
- return file.name
+ return socket_helper.create_unix_domain_name()
@contextlib.contextmanager