Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions allure-pytest/examples/label/manual/allure_manual.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Test manual label
-------------

By default, ``ALLURE_MANUAL`` label is not set.

Usage of ``allure.manual`` decorator.

>>> import allure


>>> @allure.manual
... def test_manual():
... pass

>>> def test_manual_dynamic():
... allure.dynamic.manual()
Empty file.
21 changes: 21 additions & 0 deletions allure-pytest/test/acceptance/label/manual/manual_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from hamcrest import assert_that
from allure_commons_test.report import has_test_case
from allure_commons_test.label import has_label


def test_allure_manual_label(executed_docstring_path):
""" ./examples/label/manual/allure_manual.rst """
assert_that(executed_docstring_path.allure_report,
has_test_case("test_manual",
has_label("ALLURE_MANUAL", True)
)
)


def test_allure_manual_label_dynamic(executed_docstring_path):
""" ./examples/label/manual/allure_manual.rst """
assert_that(executed_docstring_path.allure_report,
has_test_case("test_manual_dynamic",
has_label("ALLURE_MANUAL", True)
),
)
4 changes: 3 additions & 1 deletion allure-python-commons/allure.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from allure_commons._allure import Dynamic as dynamic
from allure_commons._allure import step
from allure_commons._allure import attach
from allure_commons._allure import manual
from allure_commons.types import Severity as severity_level
from allure_commons.types import AttachmentType as attachment_type

Expand All @@ -35,5 +36,6 @@
'dynamic',
'severity_level',
'attach',
'attachment_type'
'attachment_type',
'manual'
]
9 changes: 9 additions & 0 deletions allure-python-commons/src/_allure.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def id(id):
return label(LabelType.ID, id)


def manual(fn):
return label(LabelType.MANUAL, True)(fn)


def link(url, link_type=LinkType.LINK, name=None):
return safely(plugin_manager.hook.decorate_as_link(url=url, link_type=link_type, name=name))

Expand Down Expand Up @@ -140,6 +144,10 @@ def parent_suite(parent_suite_name):
def sub_suite(sub_suite_name):
Dynamic.label(LabelType.SUB_SUITE, sub_suite_name)

@staticmethod
def manual():
return Dynamic.label(LabelType.MANUAL, True)


def step(title):
if callable(title):
Expand Down Expand Up @@ -170,6 +178,7 @@ def impl(*a, **kw):
args = list(map(lambda x: represent(x), a))
with StepContext(self.title.format(*args, **params), params):
return func(*a, **kw)

return impl


Expand Down
1 change: 1 addition & 0 deletions allure-python-commons/src/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class LabelType(str):
ID = 'as_id'
FRAMEWORK = 'framework'
LANGUAGE = 'language'
MANUAL = 'ALLURE_MANUAL'


class AttachmentType(Enum):
Expand Down