Skip to content

Commit

Permalink
fix pytest-dev#4649 - also transfer markers to keywordmapping
Browse files Browse the repository at this point in the history
as it turns out it is distinct from nodekeywords and behaves completely different
  • Loading branch information
RonnyPfannschmidt committed Jan 18, 2019
1 parent 6154a5a commit 18b2c1a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Empty file added changelog/4649.bugfix.rst
Empty file.
9 changes: 5 additions & 4 deletions src/_pytest/mark/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ def from_item(cls, item):
mapped_names.add(item.name)

# Add the names added as extra keywords to current or parent items
for name in item.listextrakeywords():
mapped_names.add(name)
mapped_names.update(item.listextrakeywords())

# Add the names attached to the current function through direct assignment
if hasattr(item, "function"):
for name in item.function.__dict__:
mapped_names.add(name)
mapped_names.update(item.function.__dict__)

# add the markers to the keywords as we no longer handle them correctly
mapped_names.update(mark.name for mark in item.iter_markers())

return cls(mapped_names)

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pytest


@pytest.mark.foo
def test_mark():
pass

0 comments on commit 18b2c1a

Please sign in to comment.