Skip to content

Commit b8b89b6

Browse files
authored
add id label for allure-ee integration (via allure-framework#407)
1 parent 17154da commit b8b89b6

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

allure-pytest/test/integration/allure_ee/__init__.py

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from hamcrest import assert_that
2+
from allure_commons_test.report import has_test_case
3+
from allure_commons_test.label import has_label
4+
5+
6+
def test_allure_ee_id_label(executed_docstring_source):
7+
"""
8+
>>> import allure
9+
10+
>>> @allure.id(123)
11+
... def test_allure_ee_id_label_example():
12+
... pass
13+
"""
14+
assert_that(executed_docstring_source.allure_report,
15+
has_test_case("test_allure_ee_id_label_example",
16+
has_label("as_id", 123),
17+
)
18+
)

allure-python-commons/allure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from allure_commons._allure import label
44
from allure_commons._allure import severity
55
from allure_commons._allure import tag
6+
from allure_commons._allure import id
67
from allure_commons._allure import suite, parent_suite, sub_suite
78
from allure_commons._allure import epic, feature, story
89
from allure_commons._allure import link, issue, testcase
@@ -23,6 +24,7 @@
2324
'parent_suite',
2425
'sub_suite',
2526
'tag',
27+
'id',
2628
'epic',
2729
'feature',
2830
'story',

allure-python-commons/src/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
__all__ = [
88
'hookimpl',
99
'plugin_manager',
10-
1110
'fixture',
1211
'test'
1312
]

allure-python-commons/src/_allure.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def tag(*tags):
6363
return label(LabelType.TAG, *tags)
6464

6565

66+
def id(id):
67+
return label(LabelType.ID, id)
68+
69+
6670
def link(url, link_type=LinkType.LINK, name=None):
6771
return safely(plugin_manager.hook.decorate_as_link(url=url, link_type=link_type, name=name))
6872

allure-python-commons/src/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class LabelType(str):
2828
THREAD = 'thread'
2929
HOST = 'host'
3030
TAG = 'tag'
31+
ID = 'as_id'
3132
FRAMEWORK = 'framework'
3233
LANGUAGE = 'language'
3334

0 commit comments

Comments
 (0)