@@ -16,6 +16,9 @@ def camel_to_snake(name: str) -> str:
16
16
class ChecklistItemMeta (type ):
17
17
"""Metaclass for checklist items that provides string representation."""
18
18
19
+ _path : str = ""
20
+ _override_name : str = ""
21
+
19
22
def __new__ (mcs , name : str , bases : tuple , namespace : dict , ** kwargs ):
20
23
"""Create a new class with the parent path set."""
21
24
parent_path = kwargs .get ("parent_path" , "" )
@@ -39,6 +42,7 @@ def __new__(mcs, name: str, bases: tuple, namespace: dict, **kwargs):
39
42
for attr_name , attr_value in namespace .items ():
40
43
if isinstance (attr_value , type ) and not attr_name .startswith ("_" ):
41
44
# Create a new class with the parent path set
45
+ assert isinstance (attr_value , ChecklistItemMeta )
42
46
nested_cls = ChecklistItemMeta (
43
47
attr_value .__name__ ,
44
48
attr_value .__bases__ ,
@@ -62,10 +66,7 @@ def __repr__(cls) -> str:
62
66
class ChecklistItem (metaclass = ChecklistItemMeta ):
63
67
"""Base class for checklist items."""
64
68
65
- _path : str = ""
66
- _override_name : str = ""
67
-
68
- def __new__ (cls , * args , ** kwargs ) -> pytest .MarkDecorator :
69
+ def __new__ (cls , * args , ** kwargs ) -> pytest .MarkDecorator : # type: ignore
69
70
"""Return a pytest mark decorator for the checklist item."""
70
71
return pytest .mark .eip_checklist (cls ._path , * args , ** kwargs )
71
72
0 commit comments