Skip to content

Commit

Permalink
Fixed sqlalchemy_async to actually use asyncpg
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagamedov committed Oct 2, 2020
1 parent a1eeb5f commit fb690a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests_pg/test_source_sqlalchemy_asyncpg.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import asyncio
from sqlalchemy.util import greenlet_spawn
from sqlalchemy.ext.asyncio import create_async_engine

import hiku.sources.sqlalchemy_async
Expand All @@ -25,7 +26,8 @@ def graph_fixture(request):

@pytest.fixture(scope='class', name='db_dsn_attr')
def db_dsn_fixture(request, db_dsn):
request.cls.db_dsn = db_dsn
request.cls.db_dsn = db_dsn.replace('postgresql://',
'postgresql+asyncpg://')


@pytest.mark.usefixtures('graph_attr', 'db_dsn_attr')
Expand All @@ -39,7 +41,7 @@ async def _check(self, src, value):
{SA_ENGINE_KEY: sa_engine})
check_result(result, value)
finally:
sa_engine.sync_engine.dispose()
await greenlet_spawn(sa_engine.sync_engine.dispose)

def check(self, src, value):
asyncio.get_event_loop().run_until_complete(self._check(src, value))

0 comments on commit fb690a1

Please sign in to comment.