FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add support the display of duplicate tag names (fix #832) by sharovd · Pull Request #852 · allure-framework/allure-python · GitHub

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
17 changes: 12 additions & 5 deletions allure-pytest/src/utils.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,21 @@ def format_allure_link(config, url, link_type):


def pytest_markers(item):
markers = set()
builtin_markers = set()
for keyword in item.keywords.keys():
if any([keyword.startswith('allure_'), keyword == 'parametrize']):
continue
marker = item.get_closest_marker(keyword)
if marker is None:
continue

yield mark_to_str(marker)
for marker in item.iter_markers(name=keyword):
mark_str = mark_to_str(marker)
is_builtin_mark = mark_str.startswith("@pytest.mark.")
if is_builtin_mark:
if marker.name in builtin_markers:
continue
builtin_markers.add(marker.name)
if mark_str not in markers:
markers.add(mark_str)
yield mark_str


def mark_to_str(marker):
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def test_show_reserved_pytest_markers_full_decorator(

>>> @pytest.mark.usermark1
... @pytest.mark.usermark2
... @pytest.mark.usermark3("comment1")
... @pytest.mark.usermark3("comment2")
... @pytest.mark.parametrize("param", ["foo"])
... @pytest.mark.skipif(False, reason="reason2")
... @pytest.mark.skipif(False, reason="reason1")
Expand All @@ -50,6 +52,8 @@ def test_show_reserved_pytest_markers_full_decorator(
"test_show_reserved_pytest_markers_full_decorator_example[foo]",
has_tag("usermark1"),
has_tag("usermark2"),
has_tag("usermark3('comment1')"),
has_tag("usermark3('comment2')"),
has_tag("@pytest.mark.skipif(False, reason='reason1')"),
not_(
has_tag("@pytest.mark.skipif(False, reason='reason2')")
Expand Down

Back | FazBrowse Home | New Git URL