Skip to content

Commit d4a5c57

Browse files
committed
Revert "Fixed SETUP / TEARDOWN keyword removing"
This reverts commit 9e50c17.
1 parent 51e7f21 commit d4a5c57

File tree

5 files changed

+16
-58
lines changed

5 files changed

+16
-58
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Changelog
22

33
## [Unreleased]
4-
### Fixed
5-
- SETUP / TEARDOWN keyword removing, by @HardNorth
64

75
## [5.6.1]
86
### Added

examples/before_after/before_suite_with_steps_fail.robot

Lines changed: 0 additions & 10 deletions
This file was deleted.

robotframework_reportportal/listener.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -410,16 +410,6 @@ def start_suite(self, name: str, attributes: Dict, ts: Optional[Any] = None) ->
410410
suite.rp_item_id = self.service.start_suite(suite=suite, ts=ts)
411411
self._add_current_item(suite)
412412

413-
def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None:
414-
msg = LogMessage(message)
415-
msg.level = "DEBUG"
416-
msg.item_id = item_id
417-
msg.timestamp = timestamp
418-
self.__post_log_message(msg)
419-
420-
def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None:
421-
self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG)
422-
423413
@check_rp_enabled
424414
def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None:
425415
"""Finish started test suite at the ReportPortal.
@@ -430,11 +420,6 @@ def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None
430420
"""
431421
suite = self._remove_current_item().update(attributes)
432422
logger.debug(f"ReportPortal - End Suite: {suite.robot_attributes}")
433-
if attributes["status"] == "FAIL" and self._remove_data_passed_tests:
434-
self._post_skipped_keywords(suite)
435-
elif self._remove_data_passed_tests:
436-
for kwd in suite.skipped_keywords:
437-
self._log_keyword_content_removed(kwd.rp_item_id, kwd.start_time)
438423
self.service.finish_suite(suite=suite, ts=ts)
439424
if attributes["id"] == MAIN_SUITE_ID:
440425
self.finish_launch(attributes, ts)
@@ -456,6 +441,16 @@ def start_test(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> N
456441
test.rp_item_id = self.service.start_test(test=test, ts=ts)
457442
self._add_current_item(test)
458443

444+
def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None:
445+
msg = LogMessage(message)
446+
msg.level = "DEBUG"
447+
msg.item_id = item_id
448+
msg.timestamp = timestamp
449+
self.__post_log_message(msg)
450+
451+
def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None:
452+
self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG)
453+
459454
@check_rp_enabled
460455
def end_test(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None:
461456
"""Finish started test case at the ReportPortal.

robotframework_reportportal/model.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ class Entity:
3636
remove_origin: Optional[Any]
3737
rp_item_id: Optional[str]
3838
parent: Optional["Entity"]
39-
skipped_keywords: List["Keyword"]
40-
posted: bool
4139

4240
def __init__(self, entity_type: str, parent: Optional["Entity"]):
4341
"""Initialize required attributes.
@@ -52,8 +50,6 @@ def __init__(self, entity_type: str, parent: Optional["Entity"]):
5250
self.flattened = False
5351
self.remove_filter = None
5452
self.remove_origin = None
55-
self.skipped_keywords = []
56-
self.posted = True
5753

5854
@property
5955
def rp_parent_item_id(self):
@@ -98,6 +94,8 @@ class Keyword(Entity):
9894
tags: List[str]
9995
type: str = "KEYWORD"
10096
skipped_logs: List[LogMessage]
97+
skipped_keywords: List["Keyword"]
98+
posted: bool
10199

102100
def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity):
103101
"""Initialize required attributes.
@@ -120,7 +118,9 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity):
120118
self.status = robot_attributes.get("status")
121119
self.tags = robot_attributes["tags"]
122120
self.type = "KEYWORD"
121+
self.skipped_keywords = []
123122
self.skipped_logs = []
123+
self.posted = True
124124

125125
def get_name(self) -> str:
126126
"""Get name of the keyword suitable for ReportPortal."""
@@ -257,6 +257,7 @@ class Test(Entity):
257257
start_time: str
258258
status: str
259259
template: str
260+
skipped_keywords: List[Keyword]
260261

261262
def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: List[str], parent: Entity):
262263
"""Initialize required attributes.
@@ -280,6 +281,7 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes:
280281
self.start_time = robot_attributes["starttime"]
281282
self.status = robot_attributes.get("status")
282283
self.template = robot_attributes["template"]
284+
self.skipped_keywords = []
283285

284286
@property
285287
def critical(self) -> bool:

tests/integration/test_remove_keywords.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -302,33 +302,6 @@ def test_remove_keyword_not_provided(mock_client_init):
302302
2,
303303
"To less executions error",
304304
),
305-
(
306-
"examples/before_after/before_suite_with_steps.robot",
307-
"PASSED",
308-
0,
309-
["PASSED"] * 4,
310-
2,
311-
0,
312-
"Content removed using the --remove-keywords option.",
313-
),
314-
(
315-
"examples/before_after/after_suite_with_steps.robot",
316-
"PASSED",
317-
0,
318-
["PASSED"] * 4,
319-
2,
320-
1,
321-
"Content removed using the --remove-keywords option.",
322-
),
323-
(
324-
"examples/before_after/before_suite_with_steps_fail.robot",
325-
"PASSED",
326-
1,
327-
["FAILED"] * 4,
328-
1,
329-
0,
330-
"Suite setup step",
331-
),
332305
],
333306
)
334307
@mock.patch(REPORT_PORTAL_SERVICE)

0 commit comments

Comments
 (0)