Skip to content

Commit d9bcfa0

Browse files
committed
python: don't redundantly duplicate parent markers to own keywords
This does have a slight semantic change: in a node hierarchy parent -> child, if parent has a marker applied, then child is constructed, then `parent.themarker = "overridden"`, previously `child.keywords['themarker']` would return `True`, now it returns `"overridden"`. But that's actually what I would have expected so I see it as more of a bugfix.
1 parent 8713c32 commit d9bcfa0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/_pytest/python.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,10 +1676,11 @@ def __init__(
16761676
# todo: this is a hell of a hack
16771677
# https://github.com/pytest-dev/pytest/issues/4569
16781678

1679+
# Take own_markers only; NodeKeywords handles parent traversal on its own.
16791680
self.keywords.update(
16801681
{
16811682
mark.name: mark
1682-
for mark in self.iter_markers()
1683+
for mark in self.own_markers
16831684
if mark.name not in self.keywords
16841685
}
16851686
)

0 commit comments

Comments
 (0)