Return mock patching class with qualified name `q_class_name`. The mock is autospec'ed based on the patched class unless the optional argument `autospec` is set to False. Any other keyword arguments are passed through to Mock(). Patch is reversed after calling test returns.
(
request: FixtureRequest, q_class_name: str, autospec: bool = True, **kwargs: Any
)
| 33 | |
| 34 | |
| 35 | def class_mock( |
| 36 | request: FixtureRequest, q_class_name: str, autospec: bool = True, **kwargs: Any |
| 37 | ) -> Mock: |
| 38 | """Return mock patching class with qualified name `q_class_name`. |
| 39 | |
| 40 | The mock is autospec'ed based on the patched class unless the optional |
| 41 | argument `autospec` is set to False. Any other keyword arguments are |
| 42 | passed through to Mock(). Patch is reversed after calling test returns. |
| 43 | """ |
| 44 | _patch = patch(q_class_name, autospec=autospec, **kwargs) |
| 45 | request.addfinalizer(_patch.stop) |
| 46 | return _patch.start() |
| 47 | |
| 48 | |
| 49 | def cls_attr_mock( |
no outgoing calls
searching dependent graphs…