MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / temp_db

Function temp_db

tests/conftest.py:274–284  ·  view source on GitHub ↗

创建临时数据库实例。

(temp_db_file: Path)

Source from the content-addressed store, hash-verified

272
273@pytest_asyncio.fixture
274async def temp_db(temp_db_file: Path):
275 """创建临时数据库实例。"""
276 from astrbot.core.db.sqlite import SQLiteDatabase
277
278 db = SQLiteDatabase(str(temp_db_file))
279 try:
280 yield db
281 finally:
282 await db.engine.dispose()
283 if temp_db_file.exists():
284 temp_db_file.unlink()
285
286
287# ============================================================

Callers

nothing calls this directly

Calls 2

SQLiteDatabaseClass · 0.90
disposeMethod · 0.45

Tested by

no test coverage detected