diff --git a/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py b/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py index f47ee77c012..e2b36b1c70f 100644 --- a/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py +++ b/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py @@ -102,7 +102,7 @@ class _GenericHandler(grpc.GenericRpcHandler): def create_dummy_channel(): """Creating dummy channels is a workaround for retries""" - host, port, sock = get_socket() + host, port, sock = get_socket(sock_options=(socket.SO_REUSEADDR,)) sock.close() return grpc.insecure_channel('{}:{}'.format(host, port)) @@ -207,7 +207,7 @@ class MetadataFlagsTest(unittest.TestCase): unhandled_exceptions = queue.Queue() # We just need an unused TCP port - host, port, sock = get_socket() + host, port, sock = get_socket(sock_options=(socket.SO_REUSEADDR,)) sock.close() addr = '{}:{}'.format(host, port)