Skip to content

Commit 14ba685

Browse files
committed
Add test case tags
Changes: - extract names of Pytest markers (decorators like @pytest.mark.linux, @pytest.mark.win32 etc) and use them as Tags for Items on Report Portal.
1 parent 0bd62d5 commit 14ba685

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pytest_reportportal/plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def pytest_runtest_makereport(self, item, call):
2929
)
3030

3131
if report.when == "setup":
32-
3332
# when function pytest_setup is called,
3433
# test item session will be started in RP
3534
PyTestService.start_pytest_item(item)

pytest_reportportal/service.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from time import time
44

55
from six import with_metaclass
6+
from _pytest.mark import MarkMapping
67

78
from reportportal_client import ReportPortalServiceAsync
89

@@ -76,10 +77,14 @@ def start_pytest_item(self, test_item=None):
7677
except AttributeError:
7778
# doctest has no `function` attribute
7879
item_description = test_item.reportinfo()[2]
80+
81+
# extract names of @pytest.mark.* decorators used for test item
82+
item_tags = list(MarkMapping(test_item.keywords)._mymarks)
83+
7984
start_rq = {
8085
"name": test_item.name,
8186
"description": item_description,
82-
"tags": ['PyTest Item Tag'],
87+
"tags": item_tags,
8388
"start_time": timestamp(),
8489
"item_type": "TEST"
8590
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def read_file(fname):
1515
setup(
1616
name="pytest-reportportal",
1717
version=version,
18-
description="Agent for Reproting results of tests to the Report Portal server",
18+
description="Agent for Reporting results of tests to the Report Portal server",
1919
long_description=read_file("README.rst") + "\n\n",
2020
author="Pavel Papou",
2121
author_email="[email protected]",

0 commit comments

Comments
 (0)