Return mock for method `method_name` on `cls`. The patch is reversed after pytest uses it.
(
request: FixtureRequest,
cls: type,
method_name: str,
autospec: bool = True,
**kwargs: Any,
)
| 115 | |
| 116 | |
| 117 | def method_mock( |
| 118 | request: FixtureRequest, |
| 119 | cls: type, |
| 120 | method_name: str, |
| 121 | autospec: bool = True, |
| 122 | **kwargs: Any, |
| 123 | ): |
| 124 | """Return mock for method `method_name` on `cls`. |
| 125 | |
| 126 | The patch is reversed after pytest uses it. |
| 127 | """ |
| 128 | _patch = patch.object(cls, method_name, autospec=autospec, **kwargs) |
| 129 | request.addfinalizer(_patch.stop) |
| 130 | return _patch.start() |
| 131 | |
| 132 | |
| 133 | def open_mock(request: FixtureRequest, module_name: str, **kwargs: Any): |
no outgoing calls
searching dependent graphs…