What steps will reproduce the problem?
I had a call to mock.patch like this:
mock.patch('util.ppmixpanel.datetime')
When I couldn't get it working, I decided to try using patch.object instead. I
changed it to:
mock.patch.object('util.ppmixpanel', 'datetime', datetime.datetime)
This gave me an error message of:
File "/home/ned/.virtualenvs/pp/local/lib/python2.7/site-packages/mock.py", line 1263, in get_original
"%s does not have the attribute %r" % (target, name)
AttributeError: util.ppmixpanel does not have the attribute 'datetime'
It took me a while to figure out from the error message that it was looking for
the attribute on the string 'util.ppmixpanel'. To make this clearer, could the
%s be changed to a %r? Or perhaps include the type in the output:
AttributeError: util.ppmixpanel (str) does not have the attribute 'datetime'
What version of the product are you using? On what operating system?
This is with mock 0.8.0
Original issue reported on code.google.com by ned...@gmail.com on 13 Sep 2012 at 10:13
Original issue reported on code.google.com by
ned...@gmail.com
on 13 Sep 2012 at 10:13