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.
This commit is contained in:
Victor Stinner 2022-06-17 13:16:51 +02:00 committed by GitHub
parent ffc228dd4e
commit c5b750dc0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 82 additions and 86 deletions

View file

@ -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