Return a mock patching the 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
)
| 21 | |
| 22 | |
| 23 | def class_mock( |
| 24 | request: FixtureRequest, q_class_name: str, autospec: bool = True, **kwargs: Any |
| 25 | ) -> Mock: |
| 26 | """Return a mock patching the class with qualified name *q_class_name*. |
| 27 | |
| 28 | The mock is autospec'ed based on the patched class unless the optional argument |
| 29 | *autospec* is set to False. Any other keyword arguments are passed through to |
| 30 | Mock(). Patch is reversed after calling test returns. |
| 31 | """ |
| 32 | _patch = patch(q_class_name, autospec=autospec, **kwargs) |
| 33 | request.addfinalizer(_patch.stop) |
| 34 | return _patch.start() |
| 35 | |
| 36 | |
| 37 | def cls_attr_mock( |
no outgoing calls
searching dependent graphs…