According to the documentation and code Spy provides extra attributes: https://pytest-mock.readthedocs.io/en/latest/usage.html#spy
|
spy_obj = self.patch.object(obj, name, side_effect=wrapped, autospec=autospec) |
|
spy_obj.spy_return = None |
|
spy_obj.spy_return_iter = None |
|
spy_obj.spy_return_list = [] |
|
spy_obj.spy_exception = None |
|
return spy_obj |
But they're not listed in the Spy type.
Spy definition:
|
def spy( |
|
self, obj: object, name: str, duplicate_iterators: bool = False |
|
) -> MockType: |
Spy type definition:
|
MockType = Union[ |
|
unittest.mock.MagicMock, |
|
unittest.mock.AsyncMock, |
|
unittest.mock.NonCallableMagicMock, |
|
] |
This breaks autocomplete 😢
According to the documentation and code Spy provides extra attributes: https://pytest-mock.readthedocs.io/en/latest/usage.html#spy
pytest-mock/src/pytest_mock/plugin.py
Lines 213 to 218 in 184eb19
But they're not listed in the Spy type.
Spy definition:
pytest-mock/src/pytest_mock/plugin.py
Lines 160 to 162 in 184eb19
Spy type definition:
pytest-mock/src/pytest_mock/plugin.py
Lines 29 to 33 in 184eb19
This breaks autocomplete 😢