-
-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
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
take a detailed look at integration with the monkeypatch fixture #9
Comments
after some analysis i came to the conclusion that monkeypatch needs to be extended and a mock integration for pytest should never use mock.patch |
I'm not sure what you mean, can you clarify your request a bit please? How would you like to extend |
mock.patch maintains a custom set of own monkey-patches which is completely unaware of pytest monkeypatch is neither context nest-able, nor can it do partial undo so for a proper integration monkeypatch needs partial undo |
I'm not sure what your overall object is... to integrate While there is overlap, |
my basic understanding is that mock.patch deals with monkeypatching mock objects into places i'm not yet after a implementation unification, but i'd like to have things in place that taking mock support into pytest later on is straightforward and well combined |
I'm not sure what you mean by which means monkeypatch and mock.patch do not integrate, since I think this works: m = mock.Mock()
monkeypatch(obj, 'attr', m) |
but a monkeypatch works very different from a mock.patch - for example monkeypatch lacks selective undo |
That's true |
@nicoddemus @RonnyPfannschmidt is this still blocking merging pytest-mock into pytest? With pytest 5 dropping support for platforms without |
@graingert I'm not sure, because now users will have two builtin options, We might think about how to integrate them instead, for example def test_foo(monkeypatch):
monkeypatch.mock.patch('os.remove') Or we might decide to add def test_foo(monkeypatch):
monkeypatch.patch('os.remove') But actually I'm leaning towards leaving outside the core for now. |
This to me sounds like tmp_path and tmpdir
…On Fri, 5 Jul 2019, 15:26 Bruno Oliveira, ***@***.***> wrote:
@graingert <https://github.com/graingert> I'm not sure, because now users
will have two builtin options, monkeypatch and mocker, which is confusing.
We might think about how to integrate them instead, for example
monkeypatch.mock might behave like the current mocker fixture:
def test_foo(monkeypatch):
monkeypatch.mock.patch('os.remove')
Or we might decide to add patch and patch.object directly to monkeypatch:
def test_foo(monkeypatch):
monkeypatch.patch('os.remove')
But actually I'm leaning towards leaving outside the core for now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9?email_source=notifications&email_token=AADFATAP5YQCEDQMAWI7Q2DP55KZBA5CNFSM4A7URDH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZJU25A#issuecomment-508775796>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADFATGSJCT5UDPXP3LBIGDP55KZBANCNFSM4A7URDHQ>
.
|
IMO they are widely different: while |
No description provided.
The text was updated successfully, but these errors were encountered: