创建临时数据库实例。
(temp_db_file: Path)
| 272 | |
| 273 | @pytest_asyncio.fixture |
| 274 | async 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 | # ============================================================ |
nothing calls this directly
no test coverage detected