@@ -573,6 +573,9 @@ def set_breakpoints(
573
573
return []
574
574
575
575
def process_start_state (self , source : str , line_no : int , type : str , status : str ) -> None :
576
+ if self .state == State .CallKeyword :
577
+ return
578
+
576
579
if self .state == State .Stopped :
577
580
return
578
581
@@ -718,6 +721,8 @@ def process_end_state(
718
721
description : str ,
719
722
text : Optional [str ],
720
723
) -> None :
724
+ if self .state == State .CallKeyword :
725
+ return
721
726
if self .state == State .Stopped :
722
727
return
723
728
@@ -911,6 +916,9 @@ def remove_stackframe_entry(
911
916
self .stack_frames [0 ].stack_frames .popleft ()
912
917
913
918
def start_suite (self , name : str , attributes : Dict [str , Any ]) -> None :
919
+ if self .state == State .CallKeyword :
920
+ return
921
+
914
922
if not self .run_started :
915
923
self .run_started = True
916
924
self .debug_logger = DebugLogger ()
@@ -956,6 +964,9 @@ def start_suite(self, name: str, attributes: Dict[str, Any]) -> None:
956
964
self .wait_for_running ()
957
965
958
966
def end_suite (self , name : str , attributes : Dict [str , Any ]) -> None :
967
+ if self .state == State .CallKeyword :
968
+ return
969
+
959
970
if self .debug :
960
971
status = attributes .get ("status" , "" )
961
972
@@ -975,6 +986,9 @@ def end_suite(self, name: str, attributes: Dict[str, Any]) -> None:
975
986
self .remove_stackframe_entry (name , type , source , line_no )
976
987
977
988
def start_test (self , name : str , attributes : Dict [str , Any ]) -> None :
989
+ if self .state == State .CallKeyword :
990
+ return
991
+
978
992
source = attributes .get ("source" )
979
993
line_no_dummy = attributes .get ("lineno" , 1 )
980
994
if isinstance (line_no_dummy , str ):
@@ -999,6 +1013,9 @@ def start_test(self, name: str, attributes: Dict[str, Any]) -> None:
999
1013
self .wait_for_running ()
1000
1014
1001
1015
def end_test (self , name : str , attributes : Dict [str , Any ]) -> None :
1016
+ if self .state == State .CallKeyword :
1017
+ return
1018
+
1002
1019
if self .debug :
1003
1020
status = attributes .get ("status" , "" )
1004
1021
@@ -1030,6 +1047,9 @@ def get_current_keyword_handler(self, name: str) -> UserKeywordHandler:
1030
1047
return EXECUTION_CONTEXTS .current .namespace .get_runner (name )._handler
1031
1048
1032
1049
def start_keyword (self , name : str , attributes : Dict [str , Any ]) -> None :
1050
+ if self .state == State .CallKeyword :
1051
+ return
1052
+
1033
1053
status = attributes .get ("status" , "" )
1034
1054
source = attributes .get ("source" )
1035
1055
line_no_dummy = attributes .get ("lineno" , 1 )
@@ -1157,6 +1177,9 @@ def is_not_caugthed_by_except(self, message: Optional[str]) -> bool:
1157
1177
return True
1158
1178
1159
1179
def end_keyword (self , name : str , attributes : Dict [str , Any ]) -> None :
1180
+ if self .state == State .CallKeyword :
1181
+ return
1182
+
1160
1183
type = attributes .get ("type" )
1161
1184
if self .debug :
1162
1185
status = attributes .get ("status" , "" )
@@ -1618,6 +1641,18 @@ def _run_keyword(self, kw: Keyword, context: Any) -> Any:
1618
1641
def _run_keyword (self , kw : Keyword , context : Any ) -> Any :
1619
1642
return kw .run (context )
1620
1643
1644
+ if get_robot_version () >= (7 , 2 ):
1645
+
1646
+ @staticmethod
1647
+ def check_message_is_logged (listener : Any , msg : Any ) -> bool :
1648
+ return cast (bool , listener ._is_logged (msg ))
1649
+
1650
+ else :
1651
+
1652
+ @staticmethod
1653
+ def check_message_is_logged (listener : Any , msg : Any ) -> bool :
1654
+ return cast (bool , listener ._is_logged (msg .level ))
1655
+
1621
1656
def evaluate (
1622
1657
self ,
1623
1658
expression : str ,
@@ -1745,18 +1780,19 @@ def run_kw() -> Any:
1745
1780
result = e
1746
1781
break
1747
1782
finally :
1748
- messages = LOGGER ._log_message_cache or []
1749
- for msg in messages or ():
1750
- # hack to get and evaluate log level
1751
- listener : Any = next (iter (LOGGER ), None )
1752
- if listener is None or listener ._is_logged (msg .level ):
1753
- self .log_message (
1754
- {
1755
- "level" : msg .level ,
1756
- "message" : msg .message ,
1757
- "timestamp" : msg .timestamp ,
1758
- }
1759
- )
1783
+ if get_robot_version () <= (7 , 2 ):
1784
+ messages = LOGGER ._log_message_cache or []
1785
+ for msg in messages or ():
1786
+ # hack to get and evaluate log level
1787
+ listener : Any = next (iter (LOGGER ), None )
1788
+ if listener is None or self .check_message_is_logged (listener , msg ):
1789
+ self .log_message (
1790
+ {
1791
+ "level" : msg .level ,
1792
+ "message" : msg .message ,
1793
+ "timestamp" : msg .timestamp ,
1794
+ }
1795
+ )
1760
1796
return result
1761
1797
1762
1798
result = self .run_in_robot_thread (run_kw )
0 commit comments