我无法运行这个测试,总是出现相同的错误RuntimeError: Event loop is closed
我需要在这段代码中添加什么?
from motor.motor_asyncio import AsyncIOMotorClient
import pytest
import asyncio
client = AsyncIOMotorClient("mongodb://mongo:mongo@192.168.0.11:27017/admin?retryWrites=false")
db = client['app']
aux = db['users']
async def create_user_db(a: dict):
x = await aux.insert_one(a)
return x
@pytest.mark.asyncio
async def test_create():
form = {'username': 'c3', 'password': 'c3'}
res = await create_user_db(form)
assert res != None
这是错误信息