55
66from h2 .errors import ErrorCodes
77
8- from grpclib .const import Handler , Cardinality
8+ from grpclib .const import Handler , Cardinality , Status
99from grpclib .events import _DispatchServerEvents
1010from grpclib .server import request_handler
1111from grpclib .protocol import Connection , EventsProcessor
@@ -168,7 +168,7 @@ async def test_deadline(
168168 (':path' , '/package.Service/Method' ),
169169 ('te' , 'trailers' ),
170170 ('content-type' , 'application/grpc' ),
171- ('grpc-timeout' , '10m ' ),
171+ ('grpc-timeout' , '50m ' ),
172172 ]
173173 methods = {'/package.Service/Method' : Handler (
174174 handler ,
@@ -179,12 +179,12 @@ async def test_deadline(
179179 task = loop .create_task (
180180 call_handler (methods , stream , headers )
181181 )
182- await asyncio .wait_for (task , 0.1 )
182+ await asyncio .wait_for (task , 0.1 ) # should be bigger than grpc-timeout
183183 assert stream .__events__ == [
184184 SendHeaders (headers = [
185185 (':status' , '200' ),
186186 ('content-type' , 'application/grpc+proto' ),
187- ('grpc-status' , '4' ), # DEADLINE_EXCEEDED
187+ ('grpc-status' , str ( Status . DEADLINE_EXCEEDED . value )),
188188 ], end_stream = True ),
189189 Reset (ErrorCodes .NO_ERROR ),
190190 ]
0 commit comments