@@ -148,7 +148,6 @@ async def resolve(
148148 yield f"Response to: { request } " , request_info
149149
150150 backend = ConcreteBackend ()
151- assert isinstance (backend , BackendInterface )
152151 assert isinstance (backend , ConcreteBackend )
153152 assert backend .processes_limit == 4
154153 assert backend .requests_limit == 100
@@ -396,8 +395,7 @@ class TestRequestInfo:
396395 "scheduler_node_id" ,
397396 "scheduler_process_id" ,
398397 "scheduler_start_time" ,
399- "scheduler_timings" ,
400- "request_timings" ,
398+ "timings" ,
401399 ]
402400
403401 @pytest .fixture (
@@ -418,16 +416,13 @@ class TestRequestInfo:
418416 "scheduler_node_id" : 2 ,
419417 "scheduler_process_id" : 1 ,
420418 "scheduler_start_time" : 2000.0 ,
421- "scheduler_timings " : {
419+ "timings " : {
422420 "targeted_start" : 1900.0 ,
423421 "queued" : 1950.0 ,
424422 "dequeued" : 2000.0 ,
425423 "resolve_start" : 2050.0 ,
426424 "resolve_end" : 2100.0 ,
427425 "finalized" : 2150.0 ,
428- },
429- "request_timings" : {
430- "timings_type" : "test_request_timings" ,
431426 "request_start" : 2060.0 ,
432427 "request_end" : 2110.0 ,
433428 },
@@ -475,14 +470,8 @@ def valid_instances(self, request):
475470 constructor_args = request .param .copy ()
476471
477472 # Handle nested objects
478- if "scheduler_timings" in constructor_args :
479- constructor_args ["scheduler_timings" ] = RequestTimings (
480- ** constructor_args ["scheduler_timings" ]
481- )
482- if "request_timings" in constructor_args :
483- constructor_args ["request_timings" ] = RequestTimings .model_validate (
484- constructor_args ["request_timings" ]
485- )
473+ if "timings" in constructor_args :
474+ constructor_args ["timings" ] = RequestTimings (** constructor_args ["timings" ])
486475
487476 instance = RequestInfo (** constructor_args )
488477 return instance , constructor_args
@@ -515,12 +504,11 @@ def test_initialization(self, valid_instances):
515504
516505 # Validate that the instance attributes match the constructor args
517506 for field , expected_value in constructor_args .items ():
518- if field in [ "scheduler_timings" , "request_timings" ] :
507+ if field == "timings" :
519508 actual_value = getattr (instance , field )
520509 if expected_value is None :
521- assert actual_value is None or (
522- field == "scheduler_timings"
523- and isinstance (actual_value , RequestTimings )
510+ assert actual_value is None or isinstance (
511+ actual_value , RequestTimings
524512 )
525513 else :
526514 assert isinstance (actual_value , type (expected_value ))
@@ -573,48 +561,45 @@ def test_marshalling(self, valid_instances):
573561 original_value = getattr (instance , field )
574562 reconstructed_value = getattr (reconstructed , field )
575563
576- if field in [ "scheduler_timings" , "request_timings" ] :
564+ if field == "timings" :
577565 if original_value is not None and reconstructed_value is not None :
578566 assert (
579567 original_value .model_dump () == reconstructed_value .model_dump ()
580568 )
581569 else :
582570 assert original_value is None or isinstance (
583571 original_value ,
584- RequestTimings | RequestTimings ,
572+ RequestTimings ,
585573 )
586574 assert reconstructed_value is None or isinstance (
587575 reconstructed_value ,
588- RequestTimings | RequestTimings ,
576+ RequestTimings ,
589577 )
590578 else :
591579 assert original_value == reconstructed_value
592580
593581 @pytest .mark .smoke
594582 def test_started_at_property (self ):
595583 """Test the started_at property logic."""
596- # Test with request_timings .request_start (should take precedence)
584+ # Test with timings .request_start (should take precedence)
597585 instance = RequestInfo (
598586 request_id = "test-req" ,
599587 status = "completed" ,
600588 scheduler_node_id = 1 ,
601589 scheduler_process_id = 0 ,
602590 scheduler_start_time = 1000.0 ,
603- scheduler_timings = RequestTimings (resolve_start = 2000.0 ),
604- request_timings = RequestTimings .model_validate (
605- {"timings_type" : "test_request_timings" , "request_start" : 2100.0 }
606- ),
591+ timings = RequestTimings (resolve_start = 2000.0 , request_start = 2100.0 ),
607592 )
608593 assert instance .started_at == 2100.0
609594
610- # Test with only scheduler_timings .resolve_start
595+ # Test with only timings .resolve_start
611596 instance = RequestInfo (
612597 request_id = "test-req" ,
613598 status = "completed" ,
614599 scheduler_node_id = 1 ,
615600 scheduler_process_id = 0 ,
616601 scheduler_start_time = 1000.0 ,
617- scheduler_timings = RequestTimings (resolve_start = 2000.0 ),
602+ timings = RequestTimings (resolve_start = 2000.0 ),
618603 )
619604 assert instance .started_at == 2000.0
620605
@@ -631,28 +616,25 @@ def test_started_at_property(self):
631616 @pytest .mark .smoke
632617 def test_completed_at_property (self ):
633618 """Test the completed_at property logic."""
634- # Test with request_timings .request_end (should take precedence)
619+ # Test with timings .request_end (should take precedence)
635620 instance = RequestInfo (
636621 request_id = "test-req" ,
637622 status = "completed" ,
638623 scheduler_node_id = 1 ,
639624 scheduler_process_id = 0 ,
640625 scheduler_start_time = 1000.0 ,
641- scheduler_timings = RequestTimings (resolve_end = 2000.0 ),
642- request_timings = RequestTimings .model_validate (
643- {"timings_type" : "test_request_timings" , "request_end" : 2100.0 }
644- ),
626+ timings = RequestTimings (resolve_end = 2000.0 , request_end = 2100.0 ),
645627 )
646628 assert instance .completed_at == 2100.0
647629
648- # Test with only scheduler_timings .resolve_end
630+ # Test with only timings .resolve_end
649631 instance = RequestInfo (
650632 request_id = "test-req" ,
651633 status = "completed" ,
652634 scheduler_node_id = 1 ,
653635 scheduler_process_id = 0 ,
654636 scheduler_start_time = 1000.0 ,
655- scheduler_timings = RequestTimings (resolve_end = 2000.0 ),
637+ timings = RequestTimings (resolve_end = 2000.0 ),
656638 )
657639 assert instance .completed_at == 2000.0
658640
0 commit comments