Skip to content

Commit

Permalink
Fix Agent crash if Client could not be initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Nov 29, 2024
1 parent b00fe1a commit 36f3027
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Fixed
- Agent crash if Client could not be initialized, by @HardNorth
### Changed
- Client version updated on [5.5.10](https://github.com/reportportal/client-Python/releases/tag/5.5.10), by @HardNorth

Expand Down
7 changes: 7 additions & 0 deletions pytest_reportportal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def issue_types(self) -> Dict[str, str]:
project_settings = self.project_settings
if not isinstance(self.project_settings, dict):
project_settings = project_settings.blocking_result()
if not project_settings:
return self._issue_types
for values in project_settings["subTypes"].values():
for item in values:
self._issue_types[item["shortName"]] = item["locator"]
Expand Down Expand Up @@ -864,6 +866,10 @@ def report_fixture(self, name: str, error_msg: str) -> None:
:param name: Name of the fixture
:param error_msg: Error message
"""
if not self.rp:
yield
return

reporter = self.rp.step_reporter
item_id = reporter.start_nested_step(name, timestamp())

Expand All @@ -874,6 +880,7 @@ def report_fixture(self, name: str, error_msg: str) -> None:
if exception:
if type(exception).__name__ != 'Skipped':
status = 'FAILED'
self.post_log(name, error_msg, log_level='ERROR')
reporter.finish_nested_step(item_id, timestamp(), status)
except Exception as e:
LOGGER.error('Failed to report fixture: %s', name)
Expand Down

0 comments on commit 36f3027

Please sign in to comment.