Skip to content

Commit

Permalink
Max Item name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Oct 21, 2024
1 parent 1b4caba commit 76ceae6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog

## [Unreleased]
### Fixed
- Issue [#375](https://github.com/reportportal/agent-python-pytest/issues/375): Fix max Item name length, by @HardNorth
### Added
Issue [#332](https://github.com/reportportal/agent-python-pytest/issues/332): Support for fixture reporting, by @HardNorth
- Issue [#332](https://github.com/reportportal/agent-python-pytest/issues/332): Support for fixture reporting, by @HardNorth

## [5.4.2]
### Fixed
Expand Down
17 changes: 6 additions & 11 deletions pytest_reportportal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,21 +358,16 @@ def collect_tests(self, session: Session) -> None:
self._merge_code(test_tree)
self._build_item_paths(test_tree, [])

def _get_item_name(self, name):
def _get_item_name(self, name: str) -> str:
"""Get name of item.
:param name: Item name
:return: name
:param name: Test Item name
:return: truncated to maximum length name if needed
"""
if len(name) > MAX_ITEM_NAME_LENGTH:
name = name[:MAX_ITEM_NAME_LENGTH - len(TRUNCATION_STR)] + \
TRUNCATION_STR
log.warning(
PytestWarning(
'Test leaf ID was truncated to "{}" because of name size '
'constrains on Report Portal'.format(name)
)
)
name = name[:MAX_ITEM_NAME_LENGTH - len(TRUNCATION_STR)] + TRUNCATION_STR
log.warning(PytestWarning(
f'Test leaf ID was truncated to "{name}" because of name size constrains on Report Portal'))
return name

def _get_item_description(self, test_item):
Expand Down

0 comments on commit 76ceae6

Please sign in to comment.