Skip to content

Commit f325b89

Browse files
authored
Fix multilpie links (fixes #191 via #193)
1 parent 0fa45a6 commit f325b89

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

allure-pytest/src/helper.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ def decorate_as_label(self, label_type, labels):
3636

3737
@allure_commons.hookimpl
3838
def decorate_as_link(self, url, link_type, name):
39-
allure_link_marker = '{prefix}.{link_type}'.format(prefix=ALLURE_LINK_PREFIX, link_type=link_type)
39+
allure_link_marker = '{prefix}.{link_type}:{postfix}'.format(
40+
prefix=ALLURE_LINK_PREFIX,
41+
link_type=link_type,
42+
postfix=url
43+
)
4044
pattern = dict(self.config.option.allure_link_pattern).get(link_type, u'{}')
4145
url = pattern.format(url)
4246
allure_link = getattr(pytest.mark, allure_link_marker)

allure-pytest/test/links/function_links_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ISSUE = 'https://github.com/qameta/allure-integrations/issues/8'
1717
ISSUE_NAME = 'Github issue'
1818
TEST_CASE = 'https://github.com/qameta/allure-integrations/issues/8#issuecomment-268313637'
19+
ANOTHER_TEST_CASE = 'https://github.com/allure-framework/allure-python/issues/191'
1920
TEST_CASE_NAME = 'Comment with spec'
2021

2122

@@ -95,3 +96,16 @@ def test_with_links_cases_and_issues():
9596
... ))
9697
"""
9798
pass
99+
100+
101+
@pytest.allure.testcase(TEST_CASE, name="First")
102+
@pytest.allure.testcase(ANOTHER_TEST_CASE, name="Second")
103+
def test_multiply_some_type_links():
104+
"""
105+
>>> allure_report = getfixture('allure_report')
106+
>>> assert_that(allure_report,
107+
... has_test_case('test_multiply_some_type_links',
108+
... has_test_case_link(TEST_CASE, name='First'),
109+
... has_test_case_link(ANOTHER_TEST_CASE, name='Second')
110+
... ))
111+
"""

0 commit comments

Comments
 (0)