22import warnings
33from collections import namedtuple
44from collections .abc import MutableMapping
5+ from typing import List
6+ from typing import Optional
57from typing import Set
68
79import attr
@@ -144,7 +146,13 @@ class Mark:
144146 #: keyword arguments of the mark decorator
145147 kwargs = attr .ib () # Dict[str, object]
146148
147- def combined_with (self , other ):
149+ _param_ids_from = attr .ib (type = Optional ["Mark" ], default = None )
150+ _param_ids_generated = attr .ib (type = Optional [List [str ]], default = None )
151+
152+ def _has_param_ids (self ):
153+ return "ids" in self .kwargs or len (self .args ) >= 4
154+
155+ def combined_with (self , other : "Mark" ) -> "Mark" :
148156 """
149157 :param other: the mark to combine with
150158 :type other: Mark
@@ -153,8 +161,19 @@ def combined_with(self, other):
153161 combines by appending args and merging the mappings
154162 """
155163 assert self .name == other .name
164+
165+ param_ids_from = None # type: Optional[Mark]
166+ if self .name == "parametrize" :
167+ if other ._has_param_ids ():
168+ param_ids_from = other
169+ elif self ._has_param_ids ():
170+ param_ids_from = self
171+
156172 return Mark (
157- self .name , self .args + other .args , dict (self .kwargs , ** other .kwargs )
173+ self .name ,
174+ self .args + other .args ,
175+ dict (self .kwargs , ** other .kwargs ),
176+ param_ids_from = param_ids_from ,
158177 )
159178
160179
0 commit comments