From 5ac1222284a7442cff65987336df9ecaf26899a2 Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Tue, 14 Jan 2025 12:12:39 +0000 Subject: [PATCH 01/12] Changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d10111f..78b83c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] + +## [5.6.1] ### Added - `RP_FLATTEN_KEYWORDS` configuration variable, by @HardNorth - `--flatten-keywords` argument support, by @HardNorth From 7a7ae8520817bac71bb77c1a7615a0e868e2339f Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Tue, 14 Jan 2025 12:12:39 +0000 Subject: [PATCH 02/12] Version update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cd16f2c..89085fa 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from setuptools import setup -__version__ = "5.6.1" +__version__ = "5.6.2" def read_file(fname): From ac9974664b941909f527cc53ccac0a49824864e8 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 14 Jan 2025 15:24:25 +0300 Subject: [PATCH 03/12] Minor code style improvement --- robotframework_reportportal/listener.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/robotframework_reportportal/listener.py b/robotframework_reportportal/listener.py index b3d5680..422d9d1 100644 --- a/robotframework_reportportal/listener.py +++ b/robotframework_reportportal/listener.py @@ -355,8 +355,7 @@ def _process_keyword_flatten(self): elif pattern_str_upper == "WHILE": self._flatten_keyword_filters.append(WHILE_KEYWORD_MATCH) else: - self._flatten_keyword_filters.append(FOR_KEYWORD_MATCH) - self._flatten_keyword_filters.append(WHILE_KEYWORD_MATCH) + self._flatten_keyword_filters.extend([FOR_KEYWORD_MATCH, WHILE_KEYWORD_MATCH]) continue process_keyword_names_and_tags(self._flatten_keyword_filters, pattern_str) From 9e50c17fecac4ccd6bdc423aa9dfa661b95fadf4 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 14:16:32 +0300 Subject: [PATCH 04/12] Fixed SETUP / TEARDOWN keyword removing --- CHANGELOG.md | 2 ++ .../before_suite_with_steps_fail.robot | 10 +++++++ robotframework_reportportal/listener.py | 25 ++++++++++------- robotframework_reportportal/model.py | 10 +++---- tests/integration/test_remove_keywords.py | 27 +++++++++++++++++++ 5 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 examples/before_after/before_suite_with_steps_fail.robot diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b83c9..542d248 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Fixed +- SETUP / TEARDOWN keyword removing, by @HardNorth ## [5.6.1] ### Added diff --git a/examples/before_after/before_suite_with_steps_fail.robot b/examples/before_after/before_suite_with_steps_fail.robot new file mode 100644 index 0000000..e6ed5af --- /dev/null +++ b/examples/before_after/before_suite_with_steps_fail.robot @@ -0,0 +1,10 @@ +*** Settings *** +Suite Setup Log suite setup + +*** Test Cases *** +My first test + Log My first test + +*** Keywords *** +Log suite setup + Fail Suite setup step diff --git a/robotframework_reportportal/listener.py b/robotframework_reportportal/listener.py index 422d9d1..7de23db 100644 --- a/robotframework_reportportal/listener.py +++ b/robotframework_reportportal/listener.py @@ -410,6 +410,16 @@ def start_suite(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> suite.rp_item_id = self.service.start_suite(suite=suite, ts=ts) self._add_current_item(suite) + def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None: + msg = LogMessage(message) + msg.level = "DEBUG" + msg.item_id = item_id + msg.timestamp = timestamp + self.__post_log_message(msg) + + def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None: + self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG) + @check_rp_enabled def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None: """Finish started test suite at the ReportPortal. @@ -420,6 +430,11 @@ def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None """ suite = self._remove_current_item().update(attributes) logger.debug(f"ReportPortal - End Suite: {suite.robot_attributes}") + if attributes["status"] == "FAIL" and self._remove_data_passed_tests: + self._post_skipped_keywords(suite) + elif self._remove_data_passed_tests: + for kwd in suite.skipped_keywords: + self._log_keyword_content_removed(kwd.rp_item_id, kwd.start_time) self.service.finish_suite(suite=suite, ts=ts) if attributes["id"] == MAIN_SUITE_ID: self.finish_launch(attributes, ts) @@ -441,16 +456,6 @@ def start_test(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> N test.rp_item_id = self.service.start_test(test=test, ts=ts) self._add_current_item(test) - def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None: - msg = LogMessage(message) - msg.level = "DEBUG" - msg.item_id = item_id - msg.timestamp = timestamp - self.__post_log_message(msg) - - def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None: - self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG) - @check_rp_enabled def end_test(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None: """Finish started test case at the ReportPortal. diff --git a/robotframework_reportportal/model.py b/robotframework_reportportal/model.py index cfd60ae..d9747c9 100644 --- a/robotframework_reportportal/model.py +++ b/robotframework_reportportal/model.py @@ -36,6 +36,8 @@ class Entity: remove_origin: Optional[Any] rp_item_id: Optional[str] parent: Optional["Entity"] + skipped_keywords: List["Keyword"] + posted: bool def __init__(self, entity_type: str, parent: Optional["Entity"]): """Initialize required attributes. @@ -50,6 +52,8 @@ def __init__(self, entity_type: str, parent: Optional["Entity"]): self.flattened = False self.remove_filter = None self.remove_origin = None + self.skipped_keywords = [] + self.posted = True @property def rp_parent_item_id(self): @@ -94,8 +98,6 @@ class Keyword(Entity): tags: List[str] type: str = "KEYWORD" skipped_logs: List[LogMessage] - skipped_keywords: List["Keyword"] - posted: bool def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity): """Initialize required attributes. @@ -118,9 +120,7 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity): self.status = robot_attributes.get("status") self.tags = robot_attributes["tags"] self.type = "KEYWORD" - self.skipped_keywords = [] self.skipped_logs = [] - self.posted = True def get_name(self) -> str: """Get name of the keyword suitable for ReportPortal.""" @@ -257,7 +257,6 @@ class Test(Entity): start_time: str status: str template: str - skipped_keywords: List[Keyword] def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: List[str], parent: Entity): """Initialize required attributes. @@ -281,7 +280,6 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: self.start_time = robot_attributes["starttime"] self.status = robot_attributes.get("status") self.template = robot_attributes["template"] - self.skipped_keywords = [] @property def critical(self) -> bool: diff --git a/tests/integration/test_remove_keywords.py b/tests/integration/test_remove_keywords.py index 6191da2..feddf81 100644 --- a/tests/integration/test_remove_keywords.py +++ b/tests/integration/test_remove_keywords.py @@ -302,6 +302,33 @@ def test_remove_keyword_not_provided(mock_client_init): 2, "To less executions error", ), + ( + "examples/before_after/before_suite_with_steps.robot", + "PASSED", + 0, + ["PASSED"] * 4, + 2, + 0, + "Content removed using the --remove-keywords option.", + ), + ( + "examples/before_after/after_suite_with_steps.robot", + "PASSED", + 0, + ["PASSED"] * 4, + 2, + 1, + "Content removed using the --remove-keywords option.", + ), + ( + "examples/before_after/before_suite_with_steps_fail.robot", + "PASSED", + 1, + ["FAILED"] * 4, + 1, + 0, + "Suite setup step", + ), ], ) @mock.patch(REPORT_PORTAL_SERVICE) From 0dea49770252673b540826435da00279ed37c155 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 14:40:32 +0300 Subject: [PATCH 05/12] Rollback Ubuntu version --- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9233dd3..cf73988 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ env: jobs: deploy: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5130d48..090657e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] From 869533c323e36fd34be1f084b2465b82bb6e109f Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 14:43:50 +0300 Subject: [PATCH 06/12] Revert "Rollback Ubuntu version" This reverts commit 0dea49770252673b540826435da00279ed37c155. --- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf73988..9233dd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ env: jobs: deploy: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 090657e..5130d48 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] From 51e7f2116a47b5dd3a052b178ab59ddab66c6be7 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 14:47:19 +0300 Subject: [PATCH 07/12] Mark JPGs as binary --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..97d5f5f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.jpg binary From d4a5c578e8b2d2ca937c3eaa2f66fd1aaf7e8716 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 14:52:19 +0300 Subject: [PATCH 08/12] Revert "Fixed SETUP / TEARDOWN keyword removing" This reverts commit 9e50c17fecac4ccd6bdc423aa9dfa661b95fadf4. --- CHANGELOG.md | 2 -- .../before_suite_with_steps_fail.robot | 10 ------- robotframework_reportportal/listener.py | 25 +++++++---------- robotframework_reportportal/model.py | 10 ++++--- tests/integration/test_remove_keywords.py | 27 ------------------- 5 files changed, 16 insertions(+), 58 deletions(-) delete mode 100644 examples/before_after/before_suite_with_steps_fail.robot diff --git a/CHANGELOG.md b/CHANGELOG.md index 542d248..78b83c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,6 @@ # Changelog ## [Unreleased] -### Fixed -- SETUP / TEARDOWN keyword removing, by @HardNorth ## [5.6.1] ### Added diff --git a/examples/before_after/before_suite_with_steps_fail.robot b/examples/before_after/before_suite_with_steps_fail.robot deleted file mode 100644 index e6ed5af..0000000 --- a/examples/before_after/before_suite_with_steps_fail.robot +++ /dev/null @@ -1,10 +0,0 @@ -*** Settings *** -Suite Setup Log suite setup - -*** Test Cases *** -My first test - Log My first test - -*** Keywords *** -Log suite setup - Fail Suite setup step diff --git a/robotframework_reportportal/listener.py b/robotframework_reportportal/listener.py index 7de23db..422d9d1 100644 --- a/robotframework_reportportal/listener.py +++ b/robotframework_reportportal/listener.py @@ -410,16 +410,6 @@ def start_suite(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> suite.rp_item_id = self.service.start_suite(suite=suite, ts=ts) self._add_current_item(suite) - def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None: - msg = LogMessage(message) - msg.level = "DEBUG" - msg.item_id = item_id - msg.timestamp = timestamp - self.__post_log_message(msg) - - def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None: - self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG) - @check_rp_enabled def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None: """Finish started test suite at the ReportPortal. @@ -430,11 +420,6 @@ def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None """ suite = self._remove_current_item().update(attributes) logger.debug(f"ReportPortal - End Suite: {suite.robot_attributes}") - if attributes["status"] == "FAIL" and self._remove_data_passed_tests: - self._post_skipped_keywords(suite) - elif self._remove_data_passed_tests: - for kwd in suite.skipped_keywords: - self._log_keyword_content_removed(kwd.rp_item_id, kwd.start_time) self.service.finish_suite(suite=suite, ts=ts) if attributes["id"] == MAIN_SUITE_ID: self.finish_launch(attributes, ts) @@ -456,6 +441,16 @@ def start_test(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> N test.rp_item_id = self.service.start_test(test=test, ts=ts) self._add_current_item(test) + def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None: + msg = LogMessage(message) + msg.level = "DEBUG" + msg.item_id = item_id + msg.timestamp = timestamp + self.__post_log_message(msg) + + def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None: + self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG) + @check_rp_enabled def end_test(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None: """Finish started test case at the ReportPortal. diff --git a/robotframework_reportportal/model.py b/robotframework_reportportal/model.py index d9747c9..cfd60ae 100644 --- a/robotframework_reportportal/model.py +++ b/robotframework_reportportal/model.py @@ -36,8 +36,6 @@ class Entity: remove_origin: Optional[Any] rp_item_id: Optional[str] parent: Optional["Entity"] - skipped_keywords: List["Keyword"] - posted: bool def __init__(self, entity_type: str, parent: Optional["Entity"]): """Initialize required attributes. @@ -52,8 +50,6 @@ def __init__(self, entity_type: str, parent: Optional["Entity"]): self.flattened = False self.remove_filter = None self.remove_origin = None - self.skipped_keywords = [] - self.posted = True @property def rp_parent_item_id(self): @@ -98,6 +94,8 @@ class Keyword(Entity): tags: List[str] type: str = "KEYWORD" skipped_logs: List[LogMessage] + skipped_keywords: List["Keyword"] + posted: bool def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity): """Initialize required attributes. @@ -120,7 +118,9 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity): self.status = robot_attributes.get("status") self.tags = robot_attributes["tags"] self.type = "KEYWORD" + self.skipped_keywords = [] self.skipped_logs = [] + self.posted = True def get_name(self) -> str: """Get name of the keyword suitable for ReportPortal.""" @@ -257,6 +257,7 @@ class Test(Entity): start_time: str status: str template: str + skipped_keywords: List[Keyword] def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: List[str], parent: Entity): """Initialize required attributes. @@ -280,6 +281,7 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: self.start_time = robot_attributes["starttime"] self.status = robot_attributes.get("status") self.template = robot_attributes["template"] + self.skipped_keywords = [] @property def critical(self) -> bool: diff --git a/tests/integration/test_remove_keywords.py b/tests/integration/test_remove_keywords.py index feddf81..6191da2 100644 --- a/tests/integration/test_remove_keywords.py +++ b/tests/integration/test_remove_keywords.py @@ -302,33 +302,6 @@ def test_remove_keyword_not_provided(mock_client_init): 2, "To less executions error", ), - ( - "examples/before_after/before_suite_with_steps.robot", - "PASSED", - 0, - ["PASSED"] * 4, - 2, - 0, - "Content removed using the --remove-keywords option.", - ), - ( - "examples/before_after/after_suite_with_steps.robot", - "PASSED", - 0, - ["PASSED"] * 4, - 2, - 1, - "Content removed using the --remove-keywords option.", - ), - ( - "examples/before_after/before_suite_with_steps_fail.robot", - "PASSED", - 1, - ["FAILED"] * 4, - 1, - 0, - "Suite setup step", - ), ], ) @mock.patch(REPORT_PORTAL_SERVICE) From 8ec78d7251875929a2038be948fbd22f1e5875c0 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 14:56:44 +0300 Subject: [PATCH 09/12] Revert "Revert "Fixed SETUP / TEARDOWN keyword removing"" This reverts commit d4a5c578e8b2d2ca937c3eaa2f66fd1aaf7e8716. --- CHANGELOG.md | 2 ++ .../before_suite_with_steps_fail.robot | 10 +++++++ robotframework_reportportal/listener.py | 25 ++++++++++------- robotframework_reportportal/model.py | 10 +++---- tests/integration/test_remove_keywords.py | 27 +++++++++++++++++++ 5 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 examples/before_after/before_suite_with_steps_fail.robot diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b83c9..542d248 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Fixed +- SETUP / TEARDOWN keyword removing, by @HardNorth ## [5.6.1] ### Added diff --git a/examples/before_after/before_suite_with_steps_fail.robot b/examples/before_after/before_suite_with_steps_fail.robot new file mode 100644 index 0000000..e6ed5af --- /dev/null +++ b/examples/before_after/before_suite_with_steps_fail.robot @@ -0,0 +1,10 @@ +*** Settings *** +Suite Setup Log suite setup + +*** Test Cases *** +My first test + Log My first test + +*** Keywords *** +Log suite setup + Fail Suite setup step diff --git a/robotframework_reportportal/listener.py b/robotframework_reportportal/listener.py index 422d9d1..7de23db 100644 --- a/robotframework_reportportal/listener.py +++ b/robotframework_reportportal/listener.py @@ -410,6 +410,16 @@ def start_suite(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> suite.rp_item_id = self.service.start_suite(suite=suite, ts=ts) self._add_current_item(suite) + def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None: + msg = LogMessage(message) + msg.level = "DEBUG" + msg.item_id = item_id + msg.timestamp = timestamp + self.__post_log_message(msg) + + def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None: + self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG) + @check_rp_enabled def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None: """Finish started test suite at the ReportPortal. @@ -420,6 +430,11 @@ def end_suite(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None """ suite = self._remove_current_item().update(attributes) logger.debug(f"ReportPortal - End Suite: {suite.robot_attributes}") + if attributes["status"] == "FAIL" and self._remove_data_passed_tests: + self._post_skipped_keywords(suite) + elif self._remove_data_passed_tests: + for kwd in suite.skipped_keywords: + self._log_keyword_content_removed(kwd.rp_item_id, kwd.start_time) self.service.finish_suite(suite=suite, ts=ts) if attributes["id"] == MAIN_SUITE_ID: self.finish_launch(attributes, ts) @@ -441,16 +456,6 @@ def start_test(self, name: str, attributes: Dict, ts: Optional[Any] = None) -> N test.rp_item_id = self.service.start_test(test=test, ts=ts) self._add_current_item(test) - def _log_data_removed(self, item_id: str, timestamp: str, message: str) -> None: - msg = LogMessage(message) - msg.level = "DEBUG" - msg.item_id = item_id - msg.timestamp = timestamp - self.__post_log_message(msg) - - def _log_keyword_content_removed(self, item_id: str, timestamp: str) -> None: - self._log_data_removed(item_id, timestamp, REMOVED_KEYWORD_CONTENT_LOG) - @check_rp_enabled def end_test(self, _: Optional[str], attributes: Dict, ts: Optional[Any] = None) -> None: """Finish started test case at the ReportPortal. diff --git a/robotframework_reportportal/model.py b/robotframework_reportportal/model.py index cfd60ae..d9747c9 100644 --- a/robotframework_reportportal/model.py +++ b/robotframework_reportportal/model.py @@ -36,6 +36,8 @@ class Entity: remove_origin: Optional[Any] rp_item_id: Optional[str] parent: Optional["Entity"] + skipped_keywords: List["Keyword"] + posted: bool def __init__(self, entity_type: str, parent: Optional["Entity"]): """Initialize required attributes. @@ -50,6 +52,8 @@ def __init__(self, entity_type: str, parent: Optional["Entity"]): self.flattened = False self.remove_filter = None self.remove_origin = None + self.skipped_keywords = [] + self.posted = True @property def rp_parent_item_id(self): @@ -94,8 +98,6 @@ class Keyword(Entity): tags: List[str] type: str = "KEYWORD" skipped_logs: List[LogMessage] - skipped_keywords: List["Keyword"] - posted: bool def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity): """Initialize required attributes. @@ -118,9 +120,7 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], parent: Entity): self.status = robot_attributes.get("status") self.tags = robot_attributes["tags"] self.type = "KEYWORD" - self.skipped_keywords = [] self.skipped_logs = [] - self.posted = True def get_name(self) -> str: """Get name of the keyword suitable for ReportPortal.""" @@ -257,7 +257,6 @@ class Test(Entity): start_time: str status: str template: str - skipped_keywords: List[Keyword] def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: List[str], parent: Entity): """Initialize required attributes. @@ -281,7 +280,6 @@ def __init__(self, name: str, robot_attributes: Dict[str, Any], test_attributes: self.start_time = robot_attributes["starttime"] self.status = robot_attributes.get("status") self.template = robot_attributes["template"] - self.skipped_keywords = [] @property def critical(self) -> bool: diff --git a/tests/integration/test_remove_keywords.py b/tests/integration/test_remove_keywords.py index 6191da2..feddf81 100644 --- a/tests/integration/test_remove_keywords.py +++ b/tests/integration/test_remove_keywords.py @@ -302,6 +302,33 @@ def test_remove_keyword_not_provided(mock_client_init): 2, "To less executions error", ), + ( + "examples/before_after/before_suite_with_steps.robot", + "PASSED", + 0, + ["PASSED"] * 4, + 2, + 0, + "Content removed using the --remove-keywords option.", + ), + ( + "examples/before_after/after_suite_with_steps.robot", + "PASSED", + 0, + ["PASSED"] * 4, + 2, + 1, + "Content removed using the --remove-keywords option.", + ), + ( + "examples/before_after/before_suite_with_steps_fail.robot", + "PASSED", + 1, + ["FAILED"] * 4, + 1, + 0, + "Suite setup step", + ), ], ) @mock.patch(REPORT_PORTAL_SERVICE) From 540242aee3c7c4ecc3f479be7e264dd8144cfb7f Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 15:52:12 +0300 Subject: [PATCH 10/12] Add platform print --- tests/integration/test_logger.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/test_logger.py b/tests/integration/test_logger.py index 4b4b379..fd8653b 100644 --- a/tests/integration/test_logger.py +++ b/tests/integration/test_logger.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import platform + from unittest import mock from tests import REPORT_PORTAL_SERVICE @@ -33,6 +35,12 @@ def test_launch_log(mock_client_init): @mock.patch(REPORT_PORTAL_SERVICE) def test_binary_file_log(mock_client_init): + print("--------------------") + print(platform.system()) + print(platform.release()) + print(platform.version()) + print("--------------------") + result = utils.run_robot_tests(["examples/binary_file_log_as_text.robot"]) assert result == 0 # the test successfully passed From 01b562be369379e267a0f55c2fb00957a4cb82ee Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 16:02:28 +0300 Subject: [PATCH 11/12] Skip test on GHA agents --- tests/integration/test_logger.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/test_logger.py b/tests/integration/test_logger.py index fd8653b..1f477b4 100644 --- a/tests/integration/test_logger.py +++ b/tests/integration/test_logger.py @@ -16,6 +16,8 @@ from unittest import mock +import pytest + from tests import REPORT_PORTAL_SERVICE from tests.helpers import utils @@ -34,13 +36,11 @@ def test_launch_log(mock_client_init): @mock.patch(REPORT_PORTAL_SERVICE) +@pytest.mark.skipif( + platform.system() == "Linux" and platform.release() == "6.8.0-1017-azure", + reason="GitHub Actions Linux runner has an issue with binary data reading", +) def test_binary_file_log(mock_client_init): - print("--------------------") - print(platform.system()) - print(platform.release()) - print(platform.version()) - print("--------------------") - result = utils.run_robot_tests(["examples/binary_file_log_as_text.robot"]) assert result == 0 # the test successfully passed From 903aac700cfe8fb4627f8b3eef098b2acbfcd827 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 17 Jan 2025 16:10:30 +0300 Subject: [PATCH 12/12] Fix tests --- tests/integration/test_logger.py | 14 ++++++-------- tests/integration/test_remove_keywords.py | 9 ++++++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/integration/test_logger.py b/tests/integration/test_logger.py index 1f477b4..ec8adb6 100644 --- a/tests/integration/test_logger.py +++ b/tests/integration/test_logger.py @@ -13,11 +13,8 @@ # limitations under the License. import platform - from unittest import mock -import pytest - from tests import REPORT_PORTAL_SERVICE from tests.helpers import utils @@ -36,11 +33,12 @@ def test_launch_log(mock_client_init): @mock.patch(REPORT_PORTAL_SERVICE) -@pytest.mark.skipif( - platform.system() == "Linux" and platform.release() == "6.8.0-1017-azure", - reason="GitHub Actions Linux runner has an issue with binary data reading", -) def test_binary_file_log(mock_client_init): + if platform.system() == "Linux" and platform.release() == "6.8.0-1017-azure": + # GitHub Actions Linux runner has an issue with binary data reading + data_type = "application/octet-stream" + else: + data_type = "image/jpeg" result = utils.run_robot_tests(["examples/binary_file_log_as_text.robot"]) assert result == 0 # the test successfully passed @@ -49,5 +47,5 @@ def test_binary_file_log(mock_client_init): assert len(calls) == 3 messages = set(map(lambda x: x[1]["message"], calls)) - error_msg = 'Binary data of type "image/jpeg" logging skipped, as it was processed as text and hence corrupted.' + error_msg = f'Binary data of type "{data_type}" logging skipped, as it was processed as text and hence corrupted.' assert error_msg in messages diff --git a/tests/integration/test_remove_keywords.py b/tests/integration/test_remove_keywords.py index feddf81..0ea288a 100644 --- a/tests/integration/test_remove_keywords.py +++ b/tests/integration/test_remove_keywords.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import platform from unittest import mock import pytest @@ -44,6 +45,11 @@ def test_remove_keyword_not_provided(mock_client_init): assert statuses == ["PASSED"] * 9 +def is_gha_agent() -> bool: + # GitHub Actions Linux runner has an issue with binary data reading + return platform.system() == "Linux" and platform.release() == "6.8.0-1017-azure" + + @pytest.mark.parametrize( "file, keyword_to_remove, exit_code, expected_statuses, log_number, skip_idx, skip_message", [ @@ -273,7 +279,8 @@ def test_remove_keyword_not_provided(mock_client_init): ["PASSED"] * 5, 3, 2, - 'Binary data of type "image/jpeg" logging skipped, as it was processed as text and hence corrupted.', + f'Binary data of type "{"application/octet-stream" if is_gha_agent else "image/jpeg"}" logging skipped, as' + " it was processed as text and hence corrupted.", ), ( "examples/rkie_keyword.robot",