From d7d44e9718dcf42e794d9033fd5b5e4a6d9e5c46 Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Tue, 1 Oct 2024 07:32:23 +0000 Subject: [PATCH 1/4] Changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb5a684..e0aaf55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] + +## [5.5.8] ### Removed - Retries of requests ended with `504` HTTP status code, since it's not clear if the request was delivered or not, by @HardNorth ### Changed From 3a82a3d740c4be6e592fab371166dae4f55d2950 Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Tue, 1 Oct 2024 07:32:24 +0000 Subject: [PATCH 2/4] Version update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 679b343..feffe53 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages -__version__ = '5.5.8' +__version__ = '5.5.9' TYPE_STUBS = ['*.pyi'] From f963b72777c8c9215104bcfc09c181981e74089e Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Wed, 16 Oct 2024 17:13:57 +0300 Subject: [PATCH 3/4] Some format update --- reportportal_client/steps/__init__.py | 29 ++++++++------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/reportportal_client/steps/__init__.py b/reportportal_client/steps/__init__.py index b482395..23dd637 100644 --- a/reportportal_client/steps/__init__.py +++ b/reportportal_client/steps/__init__.py @@ -66,11 +66,7 @@ def __init__(self, rp_client): """ self.client = rp_client - def start_nested_step(self, - name, - start_time, - parameters=None, - **kwargs): + def start_nested_step(self, name, start_time, parameters=None, **_): """Start Nested Step on ReportPortal. :param name: Nested Step name @@ -80,16 +76,10 @@ def start_nested_step(self, parent_id = self.client.current_item() if not parent_id: return - return self.client.start_test_item(name, start_time, 'step', - has_stats=False, - parameters=parameters, - parent_item_id=parent_id) - - def finish_nested_step(self, - item_id, - end_time, - status=None, - **kwargs): + return self.client.start_test_item( + name, start_time, 'step', has_stats=False, parameters=parameters, parent_item_id=parent_id) + + def finish_nested_step(self, item_id, end_time, status=None, **_): """Finish a Nested Step on ReportPortal. :param item_id: Nested Step item ID @@ -125,16 +115,14 @@ def __enter__(self): rp_client = self.client or current() if not rp_client: return - self.__item_id = rp_client.step_reporter \ - .start_nested_step(self.name, timestamp(), parameters=self.params) + self.__item_id = rp_client.step_reporter.start_nested_step(self.name, timestamp(), parameters=self.params) if self.params: param_list = [ str(key) + ": " + str(value) for key, value in sorted(self.params.items()) ] param_str = 'Parameters: ' + '; '.join(param_list) - rp_client.log(timestamp(), param_str, level='INFO', - item_id=self.__item_id) + rp_client.log(timestamp(), param_str, level='INFO', item_id=self.__item_id) def __exit__(self, exc_type, exc_val, exc_tb): """Exit the runtime context related to this object.""" @@ -148,8 +136,7 @@ def __exit__(self, exc_type, exc_val, exc_tb): step_status = self.status if any((exc_type, exc_val, exc_tb)): step_status = 'FAILED' - rp_client.step_reporter \ - .finish_nested_step(self.__item_id, timestamp(), step_status) + rp_client.step_reporter.finish_nested_step(self.__item_id, timestamp(), step_status) def __call__(self, func): """Wrap and call a function reference. From 013dad4d497eb504950726f3c409e806b75bd2f8 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Wed, 16 Oct 2024 20:04:43 +0300 Subject: [PATCH 4/4] Fix empty parameter Dict conversion --- CHANGELOG.md | 2 ++ reportportal_client/core/rp_requests.py | 2 +- reportportal_client/helpers.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0aaf55..74b8b1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Fixed +- Empty parameter Dict conversion, by @HardNorth ## [5.5.8] ### Removed diff --git a/reportportal_client/core/rp_requests.py b/reportportal_client/core/rp_requests.py index 75d8aeb..932160e 100644 --- a/reportportal_client/core/rp_requests.py +++ b/reportportal_client/core/rp_requests.py @@ -295,7 +295,7 @@ def _create_request(**kwargs) -> dict: attributes = dict_to_payload(kwargs['attributes']) request['attributes'] = attributes parameters = kwargs.get('parameters') - if parameters and isinstance(parameters, dict): + if parameters is not None and isinstance(parameters, dict): parameters = dict_to_payload(kwargs['parameters']) request['parameters'] = parameters return request diff --git a/reportportal_client/helpers.py b/reportportal_client/helpers.py index d7eb95f..63debbb 100644 --- a/reportportal_client/helpers.py +++ b/reportportal_client/helpers.py @@ -130,7 +130,7 @@ def dict_to_payload(dictionary: Optional[dict]) -> Optional[List[dict]]: :param dictionary: Dictionary containing tags/attributes :return list: List of tags/attributes in the required format """ - if not dictionary: + if dictionary is None: return dictionary my_dictionary = dict(dictionary)