Patch method only in one module
<p>For example, I have some module(<code>foo.py</code>) with next code:</p>

<pre><code>import requests

def get_ip():
    return requests.get('http://jsonip.com/').content
</code></pre>

<p>And module <code>bar.py</code> with similiar code:</p>

<pre><code>import requests

def get_fb():
    return requests.get('https://fb.com/').content
</code></pre>

<p>I just can't understand why next happens:</p>

<pre><code>from mock import patch

from foo import get_ip
from bar import get_fb

with patch('foo.requests.get'):
    print(get_ip())
    print(get_fb())
</code></pre>

<p>They are two mocked:
<code>
&lt;MagicMock name='get().content' id='4352254472'&gt;
&lt;MagicMock name='get().content' id='4352254472'&gt;
</code>
It is seemed to patch only <code>foo.get_ip</code> method due to <code>with patch('foo.requests.get')</code>, but it is not.
I know that I can just get <code>bar.get_fb</code> calling out of <code>with</code> scope, but there are cases where I just run in context manager one method that calls many other, and I want to patch <code>requests</code> only in one module.
Is there any way to solve this? Without changing imports in module</p>