Skip to content

Commit

Permalink
Custom marker: overwrite class marker with method
Browse files Browse the repository at this point in the history
When you mark class, and also method, method marker is overwitten from
class. This option, to add scope='method' to that marker is way how to
recognize that it's method marker, and that it's last which should be used.

Change-Id: I032ad2fe0c34da5d6d5f06e12d3205f2f6175006
  • Loading branch information
petr-balogh committed Jun 21, 2017
1 parent 8c3c430 commit a0208af
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion _pytest/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,14 @@ class Mark(namedtuple('Mark', 'name, args, kwargs')):

def combined_with(self, other):
assert self.name == other.name
scope = self.kwargs.get('scope')
combined_args = self.args + other.args
if scope == 'method':
return Mark(
self.name, combined_args,
dict(other.kwargs, **self.kwargs))
return Mark(
self.name, self.args + other.args,
self.name, combined_args,
dict(self.kwargs, **other.kwargs))


Expand Down

0 comments on commit a0208af

Please sign in to comment.