[TIP] Mocking a cursor for use with Psycopg2

Alexander Bandukwala 7h3kk1d at gmail.com
Thu Mar 13 09:29:33 PDT 2014

I'm trying to mock access to my postgres database using the mock framework.
I saw the cursor example
The psycopg2 cursor however does not return the data set but is iterated
over example here <http://initd.org/psycopg/docs/cursor.html> under result
retrieval methods. What would be the best way to mock a cursor which can be
called with a function but also be iterated over.

Thanks for any assistance and sorry for the inexperienced question.

Alexander Bandukwala
Twitter: http://twitter.com/abanduk
Site: http://bandukwala.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140313/e2666f67/attachment.htm>

More information about the testing-in-python mailing list