@@ -130,8 +130,8 @@ class listener:
130130 _service : Optional [RobotService ]
131131 _variables : Optional [Variables ]
132132 _keyword_filters : List [_KeywordMatch ] = []
133- _remove_keyword_content : bool = False
134- _remove_keywords : bool = False
133+ _remove_all_keyword_content : bool = False
134+ _remove_passed_keywords : bool = False
135135 ROBOT_LISTENER_API_VERSION = 2
136136
137137 def __init__ (self ) -> None :
@@ -254,7 +254,7 @@ def _log_message(self, message: LogMessage) -> None:
254254 self .current_item .skipped_logs .append (message )
255255 elif (
256256 getattr (current_item , "matched_filter" , None ) is not WKUS_KEYWORD_MATCH
257- and not self ._remove_keyword_content
257+ and not self ._remove_all_keyword_content
258258 ):
259259 # Post everything skipped by '--removekeywords' option
260260 self ._post_skipped_keywords (current_item )
@@ -318,10 +318,10 @@ def _process_keyword_skip(self):
318318 for pattern_str in set (current_context .output ._settings .remove_keywords ):
319319 pattern_str_upper = pattern_str .upper ()
320320 if "ALL" == pattern_str_upper :
321- self ._remove_keyword_content = True
321+ self ._remove_all_keyword_content = True
322322 break
323323 if "PASSED" == pattern_str_upper :
324- self ._remove_keywords = True
324+ self ._remove_passed_keywords = True
325325 break
326326 if pattern_str_upper in {"NOT_RUN" , "NOTRUN" , "NOT RUN" }:
327327 self ._keyword_filters .append (_KeywordStatusEqual ("NOT RUN" ))
@@ -391,12 +391,9 @@ def start_suite(self, name: str, attributes: Dict, ts: Optional[Any] = None) ->
391391 else :
392392 logger .debug (f"ReportPortal - Start Suite: { attributes } " )
393393 suite = Suite (name , attributes )
394- suite .remove_data = self ._remove_keywords
395394 suite .rp_parent_item_id = self .parent_id
396395 suite .rp_item_id = self .service .start_suite (suite = suite , ts = ts )
397396 self ._add_current_item (suite )
398- if suite .remove_data :
399- self ._log_keyword_data_removed (suite .rp_item_id , suite .start_time )
400397
401398 @check_rp_enabled
402399 def end_suite (self , _ : Optional [str ], attributes : Dict , ts : Optional [Any ] = None ) -> None :
@@ -437,13 +434,10 @@ def start_test(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> N
437434 attributes = attributes .copy ()
438435 attributes ["source" ] = getattr (self .current_item , "source" , None )
439436 test = Test (name = name , robot_attributes = attributes , test_attributes = self .variables .test_attributes )
440- test .remove_data = self ._remove_keywords
441437 logger .debug (f"ReportPortal - Start Test: { attributes } " )
442438 test .rp_parent_item_id = self .parent_id
443439 test .rp_item_id = self .service .start_test (test = test , ts = ts )
444440 self ._add_current_item (test )
445- if test .remove_data :
446- self ._log_keyword_data_removed (test .rp_item_id , test .start_time )
447441
448442 @check_rp_enabled
449443 def end_test (self , _ : Optional [str ], attributes : Dict , ts : Optional [Any ] = None ) -> None :
@@ -482,7 +476,8 @@ def start_keyword(self, name: str, attributes: Dict, ts: Optional[Any] = None) -
482476 parent = self .current_item
483477 kwd .rp_parent_item_id = parent .rp_item_id
484478 skip_kwd = parent .remove_data
485- kwd .remove_data = skip_kwd or self ._remove_keyword_content
479+ skip_data = self ._remove_all_keyword_content or self ._remove_passed_keywords
480+ kwd .remove_data = skip_kwd or skip_data
486481
487482 if kwd .remove_data :
488483 kwd .matched_filter = getattr (parent , "matched_filter" , None )
@@ -501,7 +496,7 @@ def start_keyword(self, name: str, attributes: Dict, ts: Optional[Any] = None) -
501496 kwd .posted = False
502497 else :
503498 self ._do_start_keyword (kwd , ts )
504- if self . _remove_keyword_content :
499+ if skip_data :
505500 self ._log_keyword_content_removed (kwd .rp_item_id , kwd .start_time )
506501
507502 self ._add_current_item (kwd )
0 commit comments