I'm assuming you are getting this error from psycopg2 itself. To
use create_engine(), you'd need to mock whatever is being called that
is not compatible, which here I am assuming are things like
psycopg2.extensions.register_type,
psycopg2.extras.register_default_json, and others. Patch these with
mocks so that they have no effect.
However, if your test is just looking for the behavior of the pool,
then test against a QueuePool directly.
The tests in test/engine/test_reconnect.py make extensive use of mocks
to simulate disconnects though most of the create_engine() integration
is done using real database connections with a patch to close out the
DBAPI connection to simulate a disconnect.
> What kind of mock or fake connection object should mycreator return in the
> test
> so that above snippet will behave as I expect it to, calling mycreator
> twice?
> (Using actual connection, psycopg2.connect(), works as expected).
>
> Thanks.
> Sam
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
>
http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See
http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
sqlalchemy+...@googlegroups.com.
> To post to this group, send email to
sqlal...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sqlalchemy.
> For more options, visit
https://groups.google.com/d/optout.