You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
i tried to create own pool and create object using it
from gino.ext.starlette import Gino
from myapp.config import config
@pytest.mark.asyncio
async def test_smth(client):
db = Gino()
async with db.with_bind(bind=config['dsn']) as engine:
obj = await MyModel.create(
name='test'
bind=engine
)
response = client.get(
f'api/objects/{obj.id}/'
)
it actually works and object was created
but on line response = client.get( i get
requests/requests/sessions.py:543: in get
return self.request('GET', url, **kwargs)
starlette/starlette/testclient.py:429: in request
json=json,
requests/requests/sessions.py:530: in request
resp = self.send(prep, **send_kwargs)
requests/requests/sessions.py:643: in send
r = adapter.send(request, **kwargs)
starlette/starlette/testclient.py:243: in send
raise exc from None
starlette/starlette/testclient.py:240: in send
loop.run_until_complete(self.app(scope, receive, send))
python3/src/Lib/asyncio/base_events.py:563: in run_until_complete
self._check_runnung()
python3/src/Lib/asyncio/base_events.py:523: in _check_runnung
raise RuntimeError('This event loop is already running')
Can you give me advise of how to do it correctly?
The text was updated successfully, but these errors were encountered:
GINO version:1.0.1
Python version: 3.7
asyncpg version: 0.18.3
Description
Hello! I'm trying to figure out how to work with gino in tests of my fastapi app.
I'm following this tutorial https://python-gino.org/docs/en/1.0/tutorials/fastapi.html#
My goal is to be able to do something like this:
But for now i cant figure out how to initialize gino correctly to work with db inside tests
my client fixture look like this
where
get_app
isWhat I Did
I tried just running code above, receive:
i tried to create own pool and create object using it
it actually works and object was created
but on line
response = client.get(
i getCan you give me advise of how to do it correctly?
The text was updated successfully, but these errors were encountered: