Skip to content

Commit

Permalink
Merge pull request #241 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth authored Oct 16, 2024
2 parents 00803f1 + 013dad4 commit c44cb2a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [Unreleased]
### Fixed
- Empty parameter Dict conversion, by @HardNorth

## [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
Expand Down
2 changes: 1 addition & 1 deletion reportportal_client/core/rp_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion reportportal_client/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
29 changes: 8 additions & 21 deletions reportportal_client/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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."""
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import setup, find_packages

__version__ = '5.5.8'
__version__ = '5.5.9'

TYPE_STUBS = ['*.pyi']

Expand Down

0 comments on commit c44cb2a

Please sign in to comment.