Open GoogleCodeExporter opened 8 years ago
Do you mean patch.wrap? I don't really understand what this would do and what
"additional tracking data" it would have I'm afraid. (I'm sure you're aware of
the wraps argument to Mock, right?)
Original comment by fuzzyman
on 24 Jun 2010 at 7:49
I meant mock.wrap, because I'd like to consider it somewhat parallel to patch.
On the other hand, it actually performs the replacement and safe cleanup, so
patch.wrap would be fine.
The idea is that all objects would basically act just like they should if no
mocking was there, expect that they will also records their callargs and so on
- just like a mock wrapping an object.
What's different here is - as I said - wrappling object *specified by strings*,
so instead of writing
@patch('sys.stdin', Mock(wraps=sys.stdin)
I would just write
@patch.wrap("sys.stdin")
Original comment by kon...@gmail.com
on 24 Jun 2010 at 10:11
Ah. So if you mean:
@patch.wrap("sys.stdin")
would be the equivalent of:
@patch('sys.stdin', Mock(wraps=sys.stdin)
I would prefer it on patch than on mock as it is just another way of doing
specialised patching.
Then I understand. :-) I'm not sure how commonly wraps is used and how much
this is needed.
Original comment by fuzzyman
on 24 Jun 2010 at 10:16
patch.wrap('...') creating a mock that wraps an object, using Mock(wraps='...')
is fine.
Original comment by fuzzyman
on 26 Jun 2010 at 6:42
Original comment by fuzzyman
on 18 Jun 2011 at 12:03
Original issue reported on code.google.com by
kon...@gmail.com
on 24 Jun 2010 at 2:26