We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spy does not work on frozen dataclasses, it would be nice if it did (for instance, by using object.__setattr__(obj, name, spy)
object.__setattr__(obj, name, spy)
from dataclasses import dataclass from typing import Callable def noop(*args, **kwargs): pass @dataclass(frozen=True) class MyFrozenClass: something: Callable = noop def test_spy_frozen_dataclass(mocker: MockerFixture): o = MyFrozenClass() spy = mocker.spy(o, 'something')
Anyone also in this situation can use this workaround:
def test_spy_frozen_dataclass(mocker: MockerFixture): o = MyFrozenClass() spy = mocker.MagicMock(wraps=o.something) object.__setattr__(o, 'something', spy)
The text was updated successfully, but these errors were encountered:
Hi @jennydaman,
Thanks for the suggestion.
Sorry, something went wrong.
No branches or pull requests
Spy does not work on frozen dataclasses, it would be nice if it did (for instance, by using
object.__setattr__(obj, name, spy)
Anyone also in this situation can use this workaround:
The text was updated successfully, but these errors were encountered: