diff --git a/tests/test_run_app.py b/tests/test_run_app.py index bea5b1fa1ef..dc2d791ad1f 100644 --- a/tests/test_run_app.py +++ b/tests/test_run_app.py @@ -646,15 +646,14 @@ def test_run_app_preexisting_inet6_socket( @skip_if_no_unix_socks def test_run_app_preexisting_unix_socket( - patched_loop: asyncio.AbstractEventLoop, mocker: MockerFixture + patched_loop: asyncio.AbstractEventLoop, unix_sockname: str, mocker: MockerFixture ) -> None: app = web.Application() - sock_path = "/tmp/test_preexisting_sock1" sock = socket.socket(socket.AF_UNIX) with contextlib.closing(sock): - sock.bind(sock_path) - os.unlink(sock_path) + sock.bind(unix_sockname) + os.unlink(unix_sockname) printer = mock.Mock(wraps=stopper(patched_loop)) web.run_app(app, sock=sock, print=printer, loop=patched_loop) @@ -662,7 +661,7 @@ def test_run_app_preexisting_unix_socket( patched_loop.create_server.assert_called_with( # type: ignore[attr-defined] mock.ANY, sock=sock, backlog=128, ssl=None ) - assert f"http://unix:{sock_path}:" in printer.call_args[0][0] + assert f"http://unix:{unix_sockname}:" in printer.call_args[0][0] def test_run_app_multiple_preexisting_sockets(