File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -124,30 +124,31 @@ class A:
124
124
125
125
126
126
def test_register_skips_properties (he_pm : PluginManager ) -> None :
127
- class A :
127
+ class ClassWithProperties :
128
128
@property
129
129
def some_func (self ):
130
130
self .property_was_executed = True
131
131
return None
132
132
133
- a = A ()
134
- he_pm .register (a )
135
- assert not a .property_was_executed
133
+ test_plugin = ClassWithProperties ()
134
+ he_pm .register (test_plugin )
135
+ assert not test_plugin .property_was_executed
136
136
137
137
138
138
def test_register_skips_pydantic_fields (he_pm : PluginManager ) -> None :
139
- class A :
139
+ class PydanticModelClass :
140
140
# stub to make object look like a pydantic model
141
- model_fields = {"some_attr" : {}}
141
+ model_fields : dict = {"some_attr" : {}}
142
142
143
143
def __pydantic_core_schema__ (self ): ...
144
144
145
145
@hookimpl
146
146
def some_attr (self ): ...
147
147
148
- a = A ()
149
- pname = he_pm .register (a )
150
- assert not he_pm .get_hookcallers (he_pm .get_plugin (pname ))
148
+ test_plugin = PydanticModelClass ()
149
+ he_pm .register (test_plugin )
150
+ with pytest .raises (AttributeError ) as excinfo :
151
+ he_pm .hook .some_attr .get_hookimpls ()
151
152
152
153
153
154
def test_register_mismatch_method (he_pm : PluginManager ) -> None :
You can’t perform that action at this time.
0 commit comments