<div dir="ltr">I figured it out in the end.<br>Basically the module I wanted to patch had the same name of a package that was imported in __init__.py.<div style><br></div><div style>This made the name clash and mock was getting confused of coursre,</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/12 andrea crotti <span dir="ltr">&lt;<a href="mailto:andrea.crotti.0@gmail.com" target="_blank">andrea.crotti.0@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>I&#39;m having a strange issue with Mock (version 1.0.1) that I&#39;ve never noticed before</div><div><br></div><div>So I have a patch in this form:</div><div>    @patch(&#39;app.notifications.create_notification&#39;)</div>

<div>    def test_challenge_ended_going_in_review(self, fake_create):</div><div><br></div><div><br></div><div>but I get an error from that same test complaining about:</div><div>AttributeError: &lt;module &#39;app.handlers.notifications&#39; from &#39;/home/andrea/wazoku/wazoku/wazoku-api/api/app/handlers/notifications/__init__.pyc&#39;&gt; does not have the attribute &#39;create_notification&#39;<br>

</div><div><br></div><div>but I can&#39;t figure how and why it adds the &quot;handlers&quot; in between..</div><div>app/notifications.py is a perfectly normal module, what could be messing up things?</div>
<div><br>Thanks</div></div>
</blockquote></div><br></div>