Esempio n. 1
0
    def test_regen_conn_but_not_engine(self, async_engine):

        with async_engine.sync_engine.connect() as sync_conn:

            async_conn = AsyncConnection._retrieve_proxy_for_target(sync_conn)
            async_conn2 = AsyncConnection._retrieve_proxy_for_target(sync_conn)

            is_(async_conn, async_conn2)
            is_(async_conn.engine, async_engine)
Esempio n. 2
0
    def test_regenerate_connection(self, connection):

        async_connection = AsyncConnection._retrieve_proxy_for_target(
            connection)

        a2 = AsyncConnection._retrieve_proxy_for_target(connection)
        is_(async_connection, a2)
        is_not(async_connection, None)

        is_(async_connection.engine, a2.engine)
        is_not(async_connection.engine, None)
Esempio n. 3
0
 async def test_get_connection(self, async_engine):
     async with async_engine.connect() as conn:
         is_(
             AsyncConnection._retrieve_proxy_for_target(
                 conn.sync_connection),
             conn,
         )
Esempio n. 4
0
    def test_regen_trans_but_not_conn(self, connection_no_trans):
        sync_conn = connection_no_trans

        async_conn = AsyncConnection._retrieve_proxy_for_target(sync_conn)

        trans = sync_conn.begin()

        async_t1 = async_conn.get_transaction()

        is_(async_t1.connection, async_conn)
        is_(async_t1.sync_transaction, trans)

        async_t2 = async_conn.get_transaction()
        is_(async_t1, async_t2)
Esempio n. 5
0
 def async_connection(self, async_engine):
     with async_engine.sync_engine.connect() as conn:
         yield AsyncConnection(async_engine, conn)