Skip to content

Commit 76ceae6

Browse files
committed
Max Item name fix
1 parent 1b4caba commit 76ceae6

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Changelog
22

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

79
## [5.4.2]
810
### Fixed

pytest_reportportal/service.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,16 @@ def collect_tests(self, session: Session) -> None:
358358
self._merge_code(test_tree)
359359
self._build_item_paths(test_tree, [])
360360

361-
def _get_item_name(self, name):
361+
def _get_item_name(self, name: str) -> str:
362362
"""Get name of item.
363363
364-
:param name: Item name
365-
:return: name
364+
:param name: Test Item name
365+
:return: truncated to maximum length name if needed
366366
"""
367367
if len(name) > MAX_ITEM_NAME_LENGTH:
368-
name = name[:MAX_ITEM_NAME_LENGTH - len(TRUNCATION_STR)] + \
369-
TRUNCATION_STR
370-
log.warning(
371-
PytestWarning(
372-
'Test leaf ID was truncated to "{}" because of name size '
373-
'constrains on Report Portal'.format(name)
374-
)
375-
)
368+
name = name[:MAX_ITEM_NAME_LENGTH - len(TRUNCATION_STR)] + TRUNCATION_STR
369+
log.warning(PytestWarning(
370+
f'Test leaf ID was truncated to "{name}" because of name size constrains on Report Portal'))
376371
return name
377372

378373
def _get_item_description(self, test_item):

0 commit comments

Comments
 (0)