mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
🎨 调整旧版数据库加载逻辑 (#212)
This commit is contained in:
@@ -17,11 +17,10 @@ def config_legacy(app: App, use_legacy_config):
|
||||
from nonebot_bison.config import config_legacy as config
|
||||
|
||||
config.start_up()
|
||||
|
||||
yield config.Config()
|
||||
|
||||
config.Config().db.close()
|
||||
legacy_config = Path(config.get_config_path()[0])
|
||||
legacy_config.unlink(missing_ok=True)
|
||||
|
||||
|
||||
def test_create_and_get(config_legacy: "Config", app: App):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
async def test_migration(use_legacy_config):
|
||||
from nonebot_plugin_datastore.db import init_db
|
||||
|
||||
from nonebot_bison.config.config_legacy import config as config_legacy
|
||||
from nonebot_bison.config.config_legacy import Config
|
||||
from nonebot_bison.config.db_config import config
|
||||
|
||||
config_legacy = Config()
|
||||
config_legacy.add_subscribe(
|
||||
user=123,
|
||||
user_type="group",
|
||||
@@ -57,9 +58,10 @@ async def test_migration(use_legacy_config):
|
||||
async def test_migrate_dup(use_legacy_config):
|
||||
from nonebot_plugin_datastore.db import init_db
|
||||
|
||||
from nonebot_bison.config.config_legacy import config as config_legacy
|
||||
from nonebot_bison.config.config_legacy import Config
|
||||
from nonebot_bison.config.db_config import config
|
||||
|
||||
config_legacy = Config()
|
||||
config_legacy.add_subscribe(
|
||||
user=123,
|
||||
user_type="group",
|
||||
|
||||
Reference in New Issue
Block a user