5
5
from typing import Callable
6
6
from typing import Iterable
7
7
from typing import Mapping
8
- from typing import Optional
9
- from typing import Sequence
10
- from typing import Tuple
11
8
12
9
import attr
13
10
@@ -16,25 +13,15 @@ def is_task_function(func: Any) -> bool:
16
13
return callable (func ) and getattr (func , "__name__" , "<lambda>" ) != "<lambda>"
17
14
18
15
19
- @attr .s (frozen = True )
16
+ @attr .s (frozen = True , auto_attribs = True )
20
17
class Mark :
21
- name = attr . ib ( type = str )
18
+ name : str
22
19
"""str: Name of the mark."""
23
- args = attr . ib ( type = Tuple [Any , ...])
20
+ args : tuple [Any , ...]
24
21
"""Tuple[Any]: Positional arguments of the mark decorator."""
25
- kwargs = attr . ib ( type = Mapping [str , Any ])
22
+ kwargs : Mapping [str , Any ]
26
23
"""Mapping[str, Any]: Keyword arguments of the mark decorator."""
27
24
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
-
38
25
def combined_with (self , other : Mark ) -> Mark :
39
26
"""Return a new Mark which is a combination of this Mark and another Mark.
40
27
@@ -53,19 +40,10 @@ def combined_with(self, other: Mark) -> Mark:
53
40
"""
54
41
assert self .name == other .name
55
42
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
-
64
43
return Mark (
65
44
self .name ,
66
45
self .args + other .args ,
67
- dict (self .kwargs , ** other .kwargs ),
68
- param_ids_from = param_ids_from ,
46
+ {** self .kwargs , ** other .kwargs },
69
47
)
70
48
71
49
0 commit comments