55from typing import Callable
66from typing import Iterable
77from typing import Mapping
8- from typing import Optional
9- from typing import Sequence
10- from typing import Tuple
118
129import attr
1310
@@ -16,25 +13,15 @@ def is_task_function(func: Any) -> bool:
1613 return callable (func ) and getattr (func , "__name__" , "<lambda>" ) != "<lambda>"
1714
1815
19- @attr .s (frozen = True )
16+ @attr .s (frozen = True , auto_attribs = True )
2017class Mark :
21- name = attr . ib ( type = str )
18+ name : str
2219 """str: Name of the mark."""
23- args = attr . ib ( type = Tuple [Any , ...])
20+ args : tuple [Any , ...]
2421 """Tuple[Any]: Positional arguments of the mark decorator."""
25- kwargs = attr . ib ( type = Mapping [str , Any ])
22+ kwargs : Mapping [str , Any ]
2623 """Mapping[str, Any]: Keyword arguments of the mark decorator."""
2724
28- _param_ids_from = attr .ib (type = Optional ["Mark" ], default = None , repr = False )
29- """Optional[Mark]: Source Mark for ids with parametrize Marks."""
30- _param_ids_generated = attr .ib (
31- type = Optional [Sequence [str ]], default = None , repr = False
32- )
33- """Optional[Sequence[str]]: Resolved/generated ids with parametrize Marks."""
34-
35- def _has_param_ids (self ) -> bool :
36- return "ids" in self .kwargs or len (self .args ) >= 4
37-
3825 def combined_with (self , other : Mark ) -> Mark :
3926 """Return a new Mark which is a combination of this Mark and another Mark.
4027
@@ -53,19 +40,10 @@ def combined_with(self, other: Mark) -> Mark:
5340 """
5441 assert self .name == other .name
5542
56- # Remember source of ids with parametrize Marks.
57- param_ids_from : Mark | None = None
58- if self .name == "parametrize" :
59- if other ._has_param_ids ():
60- param_ids_from = other
61- elif self ._has_param_ids ():
62- param_ids_from = self
63-
6443 return Mark (
6544 self .name ,
6645 self .args + other .args ,
67- dict (self .kwargs , ** other .kwargs ),
68- param_ids_from = param_ids_from ,
46+ {** self .kwargs , ** other .kwargs },
6947 )
7048
7149
0 commit comments