@@ -184,6 +184,11 @@ def __init__(self) -> None:
184
184
self .hit_counts : Dict [HitCountEntry , int ] = {}
185
185
self .last_fail_message : Optional [str ] = None
186
186
self .stop_on_entry = False
187
+ self .no_debug = False
188
+
189
+ @property
190
+ def debug (self ) -> bool :
191
+ return not self .no_debug
187
192
188
193
@property
189
194
def robot_report_file (self ) -> Optional [str ]:
@@ -549,35 +554,37 @@ def start_suite(self, name: str, attributes: Dict[str, Any]) -> None:
549
554
550
555
entry = self .add_stackframe_entry (longname , type , source , line_no )
551
556
552
- if self .stop_on_entry :
553
- self .stop_on_entry = False
557
+ if self .debug :
558
+ if self .stop_on_entry :
559
+ self .stop_on_entry = False
554
560
555
- self .state = State .Paused
556
- self .send_event (
557
- self ,
558
- StoppedEvent (
559
- body = StoppedEventBody (
560
- reason = StoppedReason .ENTRY ,
561
- thread_id = threading .current_thread ().ident ,
562
- )
563
- ),
564
- )
561
+ self .state = State .Paused
562
+ self .send_event (
563
+ self ,
564
+ StoppedEvent (
565
+ body = StoppedEventBody (
566
+ reason = StoppedReason .ENTRY ,
567
+ thread_id = threading .current_thread ().ident ,
568
+ )
569
+ ),
570
+ )
565
571
566
- self .wait_for_running ()
567
- elif entry .source :
568
- self .process_start_state (entry .source , entry .line , entry .type , status )
572
+ self .wait_for_running ()
573
+ elif entry .source :
574
+ self .process_start_state (entry .source , entry .line , entry .type , status )
569
575
570
- self .wait_for_running ()
576
+ self .wait_for_running ()
571
577
572
578
def end_suite (self , name : str , attributes : Dict [str , Any ]) -> None :
573
- status = attributes .get ("status" , "" )
574
-
575
- self .process_end_state (
576
- status ,
577
- "failed_suite" ,
578
- "Suite failed." ,
579
- f"Suite failed{ f': { v } ' if (v := attributes .get ('message' , None )) else '' } " ,
580
- )
579
+ if self .debug :
580
+ status = attributes .get ("status" , "" )
581
+
582
+ self .process_end_state (
583
+ status ,
584
+ "failed_suite" ,
585
+ "Suite failed." ,
586
+ f"Suite failed{ f': { v } ' if (v := attributes .get ('message' , None )) else '' } " ,
587
+ )
581
588
582
589
if self .stack_frames :
583
590
self .stack_frames .popleft ()
@@ -592,20 +599,22 @@ def start_test(self, name: str, attributes: Dict[str, Any]) -> None:
592
599
593
600
entry = self .add_stackframe_entry (longname , type , source , line_no )
594
601
595
- if entry .source :
596
- self .process_start_state (entry .source , entry .line , entry .type , status )
602
+ if self .debug :
603
+ if entry .source :
604
+ self .process_start_state (entry .source , entry .line , entry .type , status )
597
605
598
- self .wait_for_running ()
606
+ self .wait_for_running ()
599
607
600
608
def end_test (self , name : str , attributes : Dict [str , Any ]) -> None :
601
- status = attributes .get ("status" , "" )
602
-
603
- self .process_end_state (
604
- status ,
605
- "failed_test" ,
606
- "Test failed." ,
607
- f"Test failed{ f': { v } ' if (v := attributes .get ('message' , None )) else '' } " ,
608
- )
609
+ if self .debug :
610
+ status = attributes .get ("status" , "" )
611
+
612
+ self .process_end_state (
613
+ status ,
614
+ "failed_test" ,
615
+ "Test failed." ,
616
+ f"Test failed{ f': { v } ' if (v := attributes .get ('message' , None )) else '' } " ,
617
+ )
609
618
610
619
if self .stack_frames :
611
620
self .stack_frames .popleft ()
@@ -623,18 +632,20 @@ def start_keyword(self, name: str, attributes: Dict[str, Any]) -> None:
623
632
624
633
entry = self .add_stackframe_entry (kwname , type , source , line_no )
625
634
626
- if entry .source :
627
- self .process_start_state (entry .source , entry .line , entry .type , status )
635
+ if self .debug :
636
+ if entry .source :
637
+ self .process_start_state (entry .source , entry .line , entry .type , status )
628
638
629
- self .wait_for_running ()
639
+ self .wait_for_running ()
630
640
631
641
def end_keyword (self , name : str , attributes : Dict [str , Any ]) -> None :
632
- status = attributes .get ("status" , "" )
642
+ if self .debug :
643
+ status = attributes .get ("status" , "" )
633
644
634
- if status = = "NOT RUN" :
635
- return
636
-
637
- self . process_end_state ( status , "failed_keyword" , "Keyword failed." , f"Keyword failed: { self . last_fail_message } " )
645
+ if status ! = "NOT RUN" :
646
+ self . process_end_state (
647
+ status , "failed_keyword" , "Keyword failed." , f"Keyword failed: { self . last_fail_message } "
648
+ )
638
649
639
650
if self .stack_frames :
640
651
self .stack_frames .popleft ()
@@ -674,12 +685,20 @@ def log_message(self, message: Dict[str, Any]) -> None:
674
685
if message ["level" ] == "FAIL" :
675
686
self .last_fail_message = message ["message" ]
676
687
688
+ current_frame = self .stack_frames [- 1 ] if self .stack_frames else None
689
+ source = Source (path = current_frame .source ) if current_frame else None
690
+ line = current_frame .line - 1 if current_frame else None
691
+
677
692
if self .output_log :
678
693
self .send_event (
679
694
self ,
680
695
OutputEvent (
681
696
body = OutputEventBody (
682
- output = "LOG> {timestamp} {level}: {message}\n " .format (** message ), category = "log"
697
+ output = "LOG> {timestamp} {level}: {message}\n " .format (** message ),
698
+ category = "log" ,
699
+ source = source ,
700
+ line = line ,
701
+ column = 0 if source is not None else None ,
683
702
)
684
703
),
685
704
)
0 commit comments