@@ -80,7 +80,7 @@ def async_anonymous_credentials():
8080 def event_loop ():
8181 return asyncio .get_event_loop ()
8282
83- @pytest .fixture (params = ["grpc_asyncio" , "rest_asyncio" ])
83+ @pytest_asyncio .fixture (params = ["grpc_asyncio" , "rest_asyncio" ])
8484 def async_echo (use_mtls , request , event_loop ):
8585 transport = request .param
8686 if transport == "rest_asyncio" and not HAS_ASYNC_REST_ECHO_TRANSPORT :
@@ -95,7 +95,7 @@ def async_echo(use_mtls, request, event_loop):
9595 credentials = async_anonymous_credentials (),
9696 )
9797
98- @pytest .fixture (params = ["grpc_asyncio" , "rest_asyncio" ])
98+ @pytest_asyncio .fixture (params = ["grpc_asyncio" , "rest_asyncio" ])
9999 def async_identity (use_mtls , request , event_loop ):
100100 transport = request .param
101101 if transport == "rest_asyncio" and not HAS_ASYNC_REST_IDENTITY_TRANSPORT :
@@ -303,15 +303,12 @@ class EchoMetadataClientGrpcInterceptor(
303303 grpc .StreamUnaryClientInterceptor ,
304304 grpc .StreamStreamClientInterceptor ,
305305):
306- def __init__ (self , key , value ):
307- self ._key = key
308- self ._value = value
306+ def __init__ (self ):
309307 self .request_metadata = []
310308 self .response_metadata = []
311309
312310 def _add_request_metadata (self , client_call_details ):
313311 if client_call_details .metadata is not None :
314- client_call_details .metadata .append ((self ._key , self ._value ))
315312 self .request_metadata = client_call_details .metadata
316313
317314 def intercept_unary_unary (self , continuation , client_call_details , request ):
@@ -347,15 +344,12 @@ class EchoMetadataClientGrpcAsyncInterceptor(
347344 grpc .aio .StreamUnaryClientInterceptor ,
348345 grpc .aio .StreamStreamClientInterceptor ,
349346):
350- def __init__ (self , key , value ):
351- self ._key = key
352- self ._value = value
347+ def __init__ (self ):
353348 self .request_metadata = []
354349 self .response_metadata = []
355350
356351 async def _add_request_metadata (self , client_call_details ):
357352 if client_call_details .metadata is not None :
358- client_call_details .metadata .append ((self ._key , self ._value ))
359353 self .request_metadata = client_call_details .metadata
360354
361355 async def intercept_unary_unary (self , continuation , client_call_details , request ):
@@ -390,10 +384,7 @@ def intercepted_echo_grpc(use_mtls):
390384 # The interceptor adds 'showcase-trailer' client metadata. Showcase server
391385 # echoes any metadata with key 'showcase-trailer', so the same metadata
392386 # should appear as trailing metadata in the response.
393- interceptor = EchoMetadataClientGrpcInterceptor (
394- "showcase-trailer" ,
395- "intercepted" ,
396- )
387+ interceptor = EchoMetadataClientGrpcInterceptor ()
397388 host = "localhost:7469"
398389 channel = (
399390 grpc .secure_channel (host , ssl_credentials )
@@ -413,10 +404,7 @@ async def intercepted_echo_grpc_async():
413404 # The interceptor adds 'showcase-trailer' client metadata. Showcase server
414405 # echoes any metadata with key 'showcase-trailer', so the same metadata
415406 # should appear as trailing metadata in the response.
416- interceptor = EchoMetadataClientGrpcAsyncInterceptor (
417- "showcase-trailer" ,
418- "intercepted" ,
419- )
407+ interceptor = EchoMetadataClientGrpcAsyncInterceptor ()
420408 host = "localhost:7469"
421409 channel = grpc .aio .insecure_channel (host , interceptors = [interceptor ])
422410 # intercept_channel = grpc.aio.intercept_channel(channel, interceptor)
0 commit comments