<div dir="ltr">David, <div><br></div><div>Thanks for your response. I tried that when I was exhausting all my options. That also doesn&#39;t work. </div><div><br></div><div>--</div><div>Mahdi Yusuf</div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Fri, Feb 7, 2014 at 11:07 AM, David Stanek <span dir="ltr">&lt;<a href="mailto:dstanek@dstanek.com" target="_blank">dstanek@dstanek.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Instead of <span style="line-height:16.799999237060547px;color:rgb(51,51,51);font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">mock</span><span style="line-height:16.799999237060547px;font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-weight:bold">.</span><span style="line-height:16.799999237060547px;color:rgb(51,51,51);font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">patch</span><span style="line-height:16.799999237060547px;font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">(</span><span style="color:rgb(221,17,68);font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre-wrap">&#39;miners.tasks_utils.mechanize_url&#39;</span><span style="line-height:16.799999237060547px;font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">)</span> you should try <span style="line-height:16.799999237060547px;color:rgb(51,51,51);font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">mock</span><span style="line-height:16.799999237060547px;font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-weight:bold">.</span><span style="line-height:16.799999237060547px;color:rgb(51,51,51);font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">patch</span><span style="line-height:16.799999237060547px;font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">(</span><span style="color:rgb(221,17,68);font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre-wrap">&#39;twitter_profile.mechanize_url&#39;</span><span style="line-height:16.799999237060547px;font-size:12px;white-space:pre-wrap;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace">)</span>. <div>


<br></div><div>Once your twitter_profile module is imported it will have a reference to mechanize_url.  When you patch miners.tasks_utils you are not changing this reference.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

<div><div class="h5">
On Fri, Feb 7, 2014 at 10:42 AM, Mahdi Yusuf <span dir="ltr">&lt;<a href="mailto:yusuf.mahdi@gmail.com" target="_blank">yusuf.mahdi@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div class="h5">
<div dir="ltr">I am at my wits end pretty much. I am not sure what is happening here. <div><br></div><div>I am unable to mock an import function. My code is <a href="https://gist.github.com/myusuf3/685083e70bf3f93fd43c" target="_blank">here</a>. After some reading I know you patch where the function is used not where its defined.</div>




<div><br></div><div>I have also tried everything else but the mechanize_url is till running as implemented in code not mocked in test.</div><div><br></div><div>Thoughts? </div><span><font color="#888888"><div>
<br></div><div>-- <br><div>Mahdi Yusuf</div>


</div></font></span></div>
<br></div></div>_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>David<br>blog: <a href="http://www.traceback.org" target="_blank">http://www.traceback.org</a><br>twitter: <a href="http://twitter.com/dstanek" target="_blank">http://twitter.com/dstanek</a><div>


www: <a href="http://dstanek.com" target="_blank">http://dstanek.com</a></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Mahdi Yusuf</div>
</div>