Skip to content

Commit bc47c73

Browse files
committed
Fix remove keywords for PASSED case. Add more tests
1 parent e40ab8a commit bc47c73

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

examples/while_keyword.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Documentation Example of 'WHILE' keyword reporting
55
@{fruits} apple banana cherry
66

77
*** Test Cases ***
8-
For test
8+
While test
99
${iter} = Get Length ${fruits}
1010
WHILE ${iter} > 0
1111
${iter} Evaluate ${iter} - 1

robotframework_reportportal/listener.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,16 @@ def _log_message(self, message: LogMessage) -> None:
250250
:param message: Internal message object to send
251251
"""
252252
current_item = self.current_item
253-
if current_item and not getattr(current_item, "posted", True) and message.level not in ["ERROR", "WARN"]:
253+
if not current_item:
254+
# top-level log message
255+
self.__post_log_message(message)
256+
return
257+
258+
if (
259+
not getattr(current_item, "posted", True)
260+
and getattr(current_item, "remove_data", False)
261+
and message.level not in ["ERROR", "WARN"]
262+
):
254263
self.current_item.skipped_logs.append(message)
255264
elif (
256265
getattr(current_item, "matched_filter", None) is not WKUS_KEYWORD_MATCH

tests/integration/test_remove_keywords.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,24 @@
140140
0,
141141
"Content removed using the --remove-keywords option.",
142142
),
143+
(
144+
"examples/wuks_keyword.robot",
145+
"PASSED",
146+
0,
147+
["PASSED"] * 3,
148+
1,
149+
0,
150+
"Content removed using the --remove-keywords option.",
151+
),
152+
(
153+
"examples/for_keyword.robot",
154+
"PASSED",
155+
0,
156+
["PASSED"] * 3,
157+
1,
158+
0,
159+
"Content removed using the --remove-keywords option.",
160+
),
143161
],
144162
)
145163
@mock.patch(REPORT_PORTAL_SERVICE)

0 commit comments

Comments
 (0)