Skip to content

Commit 471fe8a

Browse files
committed
Custom Item name: WIP
1 parent 1434406 commit 471fe8a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pytest_reportportal/service.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ def _create_suite_path(self, item: Item):
431431
continue
432432
self._lock(leaf, lambda p: self._create_suite(p))
433433

434-
def _get_item_name(self, mark) -> str:
435-
pass
434+
def _get_item_name(self, mark, leaf: Dict[str, Any]) -> str:
435+
return leaf['name']
436436

437437
def _get_code_ref(self, item):
438438
# Generate script path from work dir, use only backslashes to have the
@@ -557,16 +557,17 @@ def _to_attribute(self, attribute_tuple):
557557
else:
558558
return {'value': attribute_tuple[1]}
559559

560-
def _process_item_name(self, item) -> str:
560+
def _process_item_name(self, leaf: Dict[str, Any]) -> str:
561561
"""
562562
Process Item Name if set.
563563
564-
:param item: Pytest.Item
564+
:param leaf: item context
565565
:return: Item Name string
566566
"""
567+
item = leaf['item']
567568
names = [m for m in item.iter_markers() if m.name == 'name']
568569
if len(names) > 0:
569-
return self._get_item_name(names[0])
570+
return self._get_item_name(names[0], leaf)
570571

571572
def _get_parameters(self, item):
572573
"""
@@ -632,7 +633,7 @@ def _process_metadata_item_start(self, leaf: Dict[str, Any]):
632633
:param leaf: item context
633634
"""
634635
item = leaf['item']
635-
leaf['name'] = self._get_item_name(item)
636+
leaf['name'] = self._process_item_name(leaf)
636637
leaf['parameters'] = self._get_parameters(item)
637638
leaf['code_ref'] = self._get_code_ref(item)
638639
leaf['test_case_id'] = self._process_test_case_id(leaf)

0 commit comments

Comments
 (0)