Skip to content

Commit b134436

Browse files
committed
Fix logging
1 parent 8a2e6cf commit b134436

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

robotframework_reportportal/listener.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
DEFAULT_BINARY_FILE_TYPE = "application/octet-stream"
4343
TRUNCATION_SIGN = "...'"
44-
REMOVED_KEYWORD_DATA_LOG = "Keyword data removed using --removeKeywords option."
4544
REMOVED_KEYWORD_CONTENT_LOG = "Content removed using the --remove-keywords option."
4645
REMOVED_WKUS_KEYWORD_LOG = "{number} failing items removed using the --remove-keywords option."
4746
REMOVED_FOR_WHILE_KEYWORD_LOG = "{number} passing items removed using the --remove-keywords option."
@@ -422,23 +421,11 @@ def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None
422421
:param ts: Timestamp(used by the ResultVisitor)
423422
"""
424423
suite = self._remove_current_item().update(attributes)
425-
if suite.remove_data and attributes["status"] == "FAIL":
426-
self._post_skipped_keywords(suite)
427424
logger.debug(f"ReportPortal - End Suite: {suite.robot_attributes}")
428425
self.service.finish_suite(suite=suite, ts=ts)
429426
if attributes["id"] == MAIN_SUITE_ID:
430427
self.finish_launch(attributes, ts)
431428

432-
def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None:
433-
msg = LogMessage(message)
434-
msg.level = "DEBUG"
435-
msg.item_id = item_id
436-
msg.timestamp = timestamp
437-
self.__post_log_message(msg)
438-
439-
def _log_keyword_data_removed(self, item_id: str, timestamp: str) -> None:
440-
self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_DATA_LOG)
441-
442429
@check_rp_enabled
443430
def start_test(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> None:
444431
"""Start a new test case at the ReportPortal.
@@ -477,6 +464,13 @@ def end_test(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None)
477464
self._remove_current_item()
478465
self.service.finish_test(test=test, ts=ts)
479466

467+
def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None:
468+
msg = LogMessage(message)
469+
msg.level = "DEBUG"
470+
msg.item_id = item_id
471+
msg.timestamp = timestamp
472+
self.__post_log_message(msg)
473+
480474
def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None:
481475
self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG)
482476

@@ -572,7 +566,7 @@ def end_keyword(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = No
572566
if self._remove_all_keyword_content:
573567
self._log_keyword_content_removed(kwd.rp_item_id, kwd.start_time)
574568
elif not self._remove_data_passed_tests:
575-
self._log_keyword_data_removed(kwd.rp_item_id, kwd.start_time)
569+
self._log_keyword_content_removed(kwd.rp_item_id, kwd.start_time)
576570

577571
self._remove_current_item()
578572
if not kwd.posted:

tests/integration/test_remove_keywords.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ def test_remove_keyword_not_provided(mock_client_init):
233233
0,
234234
"Keyword 'Fail on first try' failed after retrying 3 times. The last error was: To less executions",
235235
),
236+
(
237+
"examples/binary_file_log_as_image.robot",
238+
"tag:binary",
239+
0,
240+
["PASSED"] * 3,
241+
1,
242+
0,
243+
"Content removed using the --remove-keywords option.",
244+
),
236245
],
237246
)
238247
@mock.patch(REPORT_PORTAL_SERVICE)

0 commit comments

Comments
 (0)