@@ -573,6 +573,9 @@ def set_breakpoints(
573573 return []
574574
575575 def process_start_state (self , source : str , line_no : int , type : str , status : str ) -> None :
576+ if self .state == State .CallKeyword :
577+ return
578+
576579 if self .state == State .Stopped :
577580 return
578581
@@ -718,6 +721,8 @@ def process_end_state(
718721 description : str ,
719722 text : Optional [str ],
720723 ) -> None :
724+ if self .state == State .CallKeyword :
725+ return
721726 if self .state == State .Stopped :
722727 return
723728
@@ -911,6 +916,9 @@ def remove_stackframe_entry(
911916 self .stack_frames [0 ].stack_frames .popleft ()
912917
913918 def start_suite (self , name : str , attributes : Dict [str , Any ]) -> None :
919+ if self .state == State .CallKeyword :
920+ return
921+
914922 if not self .run_started :
915923 self .run_started = True
916924 self .debug_logger = DebugLogger ()
@@ -956,6 +964,9 @@ def start_suite(self, name: str, attributes: Dict[str, Any]) -> None:
956964 self .wait_for_running ()
957965
958966 def end_suite (self , name : str , attributes : Dict [str , Any ]) -> None :
967+ if self .state == State .CallKeyword :
968+ return
969+
959970 if self .debug :
960971 status = attributes .get ("status" , "" )
961972
@@ -975,6 +986,9 @@ def end_suite(self, name: str, attributes: Dict[str, Any]) -> None:
975986 self .remove_stackframe_entry (name , type , source , line_no )
976987
977988 def start_test (self , name : str , attributes : Dict [str , Any ]) -> None :
989+ if self .state == State .CallKeyword :
990+ return
991+
978992 source = attributes .get ("source" )
979993 line_no_dummy = attributes .get ("lineno" , 1 )
980994 if isinstance (line_no_dummy , str ):
@@ -999,6 +1013,9 @@ def start_test(self, name: str, attributes: Dict[str, Any]) -> None:
9991013 self .wait_for_running ()
10001014
10011015 def end_test (self , name : str , attributes : Dict [str , Any ]) -> None :
1016+ if self .state == State .CallKeyword :
1017+ return
1018+
10021019 if self .debug :
10031020 status = attributes .get ("status" , "" )
10041021
@@ -1030,6 +1047,9 @@ def get_current_keyword_handler(self, name: str) -> UserKeywordHandler:
10301047 return EXECUTION_CONTEXTS .current .namespace .get_runner (name )._handler
10311048
10321049 def start_keyword (self , name : str , attributes : Dict [str , Any ]) -> None :
1050+ if self .state == State .CallKeyword :
1051+ return
1052+
10331053 status = attributes .get ("status" , "" )
10341054 source = attributes .get ("source" )
10351055 line_no_dummy = attributes .get ("lineno" , 1 )
@@ -1157,6 +1177,9 @@ def is_not_caugthed_by_except(self, message: Optional[str]) -> bool:
11571177 return True
11581178
11591179 def end_keyword (self , name : str , attributes : Dict [str , Any ]) -> None :
1180+ if self .state == State .CallKeyword :
1181+ return
1182+
11601183 type = attributes .get ("type" )
11611184 if self .debug :
11621185 status = attributes .get ("status" , "" )
@@ -1618,6 +1641,18 @@ def _run_keyword(self, kw: Keyword, context: Any) -> Any:
16181641 def _run_keyword (self , kw : Keyword , context : Any ) -> Any :
16191642 return kw .run (context )
16201643
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+
16211656 def evaluate (
16221657 self ,
16231658 expression : str ,
@@ -1745,18 +1780,19 @@ def run_kw() -> Any:
17451780 result = e
17461781 break
17471782 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+ )
17601796 return result
17611797
17621798 result = self .run_in_robot_thread (run_kw )
0 commit comments