Skip to content

Commit 89c29c3

Browse files
committed
Remove redundant truncation (now done at the client level)
1 parent e89522b commit 89c29c3

2 files changed

Lines changed: 8 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Changed
5+
- Client version updated to [5.7.4](https://github.com/reportportal/client-Python/releases/tag/5.7.4), by @HardNorth
6+
### Removed
7+
- Redundant item name truncation (now handled on the Client level), by @HardNorth
48

59
## [5.6.5]
610
### Fixed

pytest_reportportal/service.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from _pytest.doctest import DoctestItem
3030
from py.path import local
31-
from pytest import Class, Function, Item, Module, Package, PytestWarning, Session
31+
from pytest import Class, Function, Item, Module, Package, Session
3232
from reportportal_client.aio import Task
3333
from reportportal_client.core.rp_issues import ExternalIssue, Issue
3434
from reportportal_client.helpers import markdown_helpers, timestamp
@@ -80,8 +80,6 @@
8080
LOGGER = logging.getLogger(__name__)
8181

8282
KNOWN_LOG_LEVELS = ("TRACE", "DEBUG", "INFO", "WARN", "ERROR")
83-
MAX_ITEM_NAME_LENGTH: int = 1024
84-
TRUNCATION_STR: str = "..."
8583
ROOT_DIR: str = str(os.path.abspath(curdir))
8684
PYTEST_MARKS_IGNORE: set[str] = {"parametrize", "usefixtures", "filterwarnings"}
8785
NOT_ISSUE: Issue = Issue("NOT_ISSUE")
@@ -497,21 +495,6 @@ def collect_tests(self, session: Session) -> None:
497495
self._merge_code(test_tree)
498496
self._build_item_paths(test_tree, [])
499497

500-
def _truncate_item_name(self, name: str) -> str:
501-
"""Get name of item.
502-
503-
:param name: Test Item name
504-
:return: truncated to maximum length name if needed
505-
"""
506-
if len(name) > MAX_ITEM_NAME_LENGTH:
507-
name = name[: MAX_ITEM_NAME_LENGTH - len(TRUNCATION_STR)] + TRUNCATION_STR
508-
LOGGER.warning(
509-
PytestWarning(
510-
f'Test leaf ID was truncated to "{name}" because of name size constrains on Report Portal'
511-
)
512-
)
513-
return name
514-
515498
def _get_item_description(self, test_item: Any) -> Optional[str]:
516499
"""Get description of item.
517500
@@ -580,7 +563,7 @@ def _build_start_suite_rq(self, leaf: dict[str, Any]) -> dict[str, Any]:
580563
parent_item_id = self._lock(leaf["parent"], lambda p: p.get("item_id")) if "parent" in leaf else None
581564
item = leaf["item"]
582565
payload = {
583-
"name": self._truncate_item_name(leaf["name"]),
566+
"name": leaf["name"],
584567
"description": self._get_item_description(item),
585568
"start_time": timestamp(),
586569
"item_type": "SUITE",
@@ -882,7 +865,7 @@ def _process_metadata_item_finish(self, leaf: dict[str, Any]) -> None:
882865
def _build_start_step_rq(self, leaf: dict[str, Any]) -> dict[str, Any]:
883866
payload = {
884867
"attributes": leaf.get("attributes", None),
885-
"name": self._truncate_item_name(leaf["name"]),
868+
"name": leaf["name"],
886869
"description": leaf["description"],
887870
"start_time": timestamp(),
888871
"item_type": "STEP",
@@ -1351,7 +1334,7 @@ def start_bdd_step(self, feature: Feature, scenario: Scenario, step: Step) -> No
13511334
if feature.background:
13521335
background_leaf = scenario_leaf["children"][feature.background]
13531336
self._finish_bdd_step(background_leaf, "PASSED")
1354-
item_id = reporter.start_nested_step(self._truncate_item_name(f"{step.keyword} {step.name}"), timestamp())
1337+
item_id = reporter.start_nested_step(f"{step.keyword} {step.name}", timestamp())
13551338
step_leaf["item_id"] = item_id
13561339
step_leaf["exec"] = ExecStatus.IN_PROGRESS
13571340

0 commit comments

Comments
 (0)