Skip to content

Commit

Permalink
fix: 补上忘记的 drivers.json 文件 (#155)
Browse files Browse the repository at this point in the history
商店还需要驱动器列表。
  • Loading branch information
he0119 authored Jul 8, 2023
1 parent 1b1c139 commit 9eb7dc2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ jobs:
curl -sSL https://raw.githubusercontent.com/nonebot/registry/results/plugins.json -o plugin_test/store/previous_plugins.json
curl -sSL https://raw.githubusercontent.com/nonebot/nonebot2/master/website/static/adapters.json -o plugin_test/store/adapters.json
curl -sSL https://raw.githubusercontent.com/nonebot/nonebot2/master/website/static/bots.json -o plugin_test/store/bots.json
curl -sSL https://raw.githubusercontent.com/nonebot/nonebot2/master/website/static/drivers.json -o plugin_test/store/drivers.json
curl -sSL https://raw.githubusercontent.com/nonebot/nonebot2/master/website/static/plugins.json -o plugin_test/store/plugins.json
- name: Test plugin
Expand All @@ -223,6 +224,7 @@ jobs:
${{ github.workspace }}/plugin_test/results.json
${{ github.workspace }}/plugin_test/adapters.json
${{ github.workspace }}/plugin_test/bots.json
${{ github.workspace }}/plugin_test/drivers.json
${{ github.workspace }}/plugin_test/plugins.json
upload_results:
Expand Down
12 changes: 8 additions & 4 deletions src/utils/store_test/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

STORE_DIR = Path("plugin_test") / "store"
""" 商店信息文件夹 """
STORE_PLUGINS_PATH = STORE_DIR / "plugins.json"
""" 插件列表文件路径 """
STORE_BOTS_PATH = STORE_DIR / "bots.json"
""" 机器人列表文件路径 """
STORE_ADAPTERS_PATH = STORE_DIR / "adapters.json"
""" 适配器列表文件路径 """
STORE_BOTS_PATH = STORE_DIR / "bots.json"
""" 机器人列表文件路径 """
STORE_DRIVERS_PATH = STORE_DIR / "drivers.json"
""" 驱动器列表文件路径 """
STORE_PLUGINS_PATH = STORE_DIR / "plugins.json"
""" 插件列表文件路径 """
PREVIOUS_RESULTS_PATH = STORE_DIR / "previous_results.json"
""" 上次测试生成的结果文件路径 """
PREVIOUS_PLUGINS_PATH = STORE_DIR / "previous_plugins.json"
Expand All @@ -33,5 +35,7 @@
""" 生成的适配器列表保存路径 """
BOTS_PATH = TEST_DIR / "bots.json"
""" 生成的机器人列表保存路径 """
DRIVERS_PATH = TEST_DIR / "drivers.json"
""" 生成的驱动器列表保存路径 """
PLUGINS_PATH = TEST_DIR / "plugins.json"
""" 生成的插件列表保存路径 """
12 changes: 8 additions & 4 deletions src/utils/store_test/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
from .constants import (
ADAPTERS_PATH,
BOTS_PATH,
DRIVERS_PATH,
PLUGIN_KEY_TEMPLATE,
PLUGINS_PATH,
PREVIOUS_PLUGINS_PATH,
PREVIOUS_RESULTS_PATH,
RESULTS_PATH,
STORE_ADAPTERS_PATH,
STORE_BOTS_PATH,
STORE_DRIVERS_PATH,
STORE_PLUGINS_PATH,
)
from .models import Plugin, StorePlugin, TestResult
Expand All @@ -31,15 +33,16 @@ def __init__(
self._force = force

# NoneBot 仓库中的数据
self._store_adapters = load_json(STORE_ADAPTERS_PATH)
self._store_bots = load_json(STORE_BOTS_PATH)
self._store_drivers = load_json(STORE_DRIVERS_PATH)
self._store_plugins: dict[str, StorePlugin] = {
PLUGIN_KEY_TEMPLATE.format(
project_link=plugin["project_link"],
module_name=plugin["module_name"],
): plugin
for plugin in load_json(STORE_PLUGINS_PATH)
}
self._store_bots = load_json(STORE_BOTS_PATH)
self._store_adapters = load_json(STORE_ADAPTERS_PATH)
# 上次测试的结果
self._previous_results: dict[str, TestResult] = load_json(PREVIOUS_RESULTS_PATH)
self._previous_plugins: dict[str, Plugin] = {
Expand Down Expand Up @@ -139,6 +142,7 @@ async def run(self, key: str | None = None, config: str | None = None):

# 保存测试结果与生成的列表
dump_json(RESULTS_PATH, results)
dump_json(PLUGINS_PATH, list(plugins.values()))
dump_json(BOTS_PATH, self._store_bots)
dump_json(ADAPTERS_PATH, self._store_adapters)
dump_json(BOTS_PATH, self._store_bots)
dump_json(DRIVERS_PATH, self._store_drivers)
dump_json(PLUGINS_PATH, list(plugins.values()))

0 comments on commit 9eb7dc2

Please sign in to comment.