<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"><<a href="mailto:andrea.crotti.0@gmail.com" target="_blank">andrea.crotti.0@gmail.com</a>></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'm having a strange issue with Mock (version 1.0.1) that I've never noticed before</div><div><br></div><div>So I have a patch in this form:</div><div> @patch('app.notifications.create_notification')</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: <module 'app.handlers.notifications' from '/home/andrea/wazoku/wazoku/wazoku-api/api/app/handlers/notifications/__init__.pyc'> does not have the attribute 'create_notification'<br>
</div><div><br></div><div>but I can't figure how and why it adds the "handlers" 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>