GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — exclude duplicate links in report (via #414) · onefar/allure-python@a0fa2ca

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • allure-pytest
    • src
      • listener.py
    • test/acceptance/link
      • dynamic_link_test.py
  • allure-python-commons-test/src
    • result.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎allure-pytest/src/listener.py‎

Copy file name to clipboardExpand all lines: allure-pytest/src/listener.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,12 @@ def add_link(self, url, link_type, name):
242242
test_result = self.allure_logger.get_test(None)
243243
if test_result:
244244
pattern = dict(self.config.option.allure_link_pattern).get(link_type, u'{}')
245-
url = pattern.format(url)
246-
test_result.links.append(Link(link_type, url, name))
245+
link_url = pattern.format(url)
246+
new_link = Link(link_type, link_url, link_url if name is None else name)
247+
for link in test_result.links:
248+
if link.url == new_link.url:
249+
return
250+
test_result.links.append(new_link)
247251

248252
@allure_commons.hookimpl
249253
def add_label(self, label_type, labels):
Collapse file

‎allure-pytest/test/acceptance/link/dynamic_link_test.py‎

Copy file name to clipboardExpand all lines: allure-pytest/test/acceptance/link/dynamic_link_test.py
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" ./examples/link/dynamic_link.rst """
22

33
import pytest
4-
from hamcrest import assert_that
4+
from hamcrest import assert_that, equal_to
55
from allure_commons_test.report import has_test_case
66
from allure_commons_test.result import has_link
77
from allure_commons_test.result import has_issue_link
@@ -28,7 +28,19 @@ def test_all_links_together(executed_docstring_path):
2828
assert_that(executed_docstring_path.allure_report,
2929
has_test_case("test_all_links_together",
3030
has_issue_link("issues/24"),
31-
has_issue_link("issues/24"),
31+
has_issue_link("issues/132"),
3232
has_link("allure", name="QAMETA", link_type="docs")
3333
)
3434
)
35+
36+
37+
def test_unique_dynamic_links(executed_docstring_source):
38+
"""
39+
>>> import allure
40+
41+
>>> def test_unique_dynamic_links_example():
42+
... allure.dynamic.link("some/unique/dynamic/link")
43+
... allure.dynamic.link("some/unique/dynamic/link")
44+
"""
45+
assert_that(executed_docstring_source.allure_report.test_cases[0]['links'],
46+
equal_to([{'url': u'some/unique/dynamic/link', 'type': 'link', 'name': u'some/unique/dynamic/link'}]))
Collapse file

‎allure-python-commons-test/src/result.py‎

Copy file name to clipboardExpand all lines: allure-python-commons-test/src/result.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,3 @@ def with_trace_contains(string):
159159

160160
def has_history_id():
161161
return has_entry('historyId', anything())
162-

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.