⬆️ 升级至 NoneBug 0.3

* 🚧 第一次尝试 50/82

* 62/82 调整了清除数据库的位置

* 🚧 pytest-mock

* 🚧 fix test_send

* 🚧 intruduce app request

* 🚧 close and remove tinydb after each test

* 🚧 clean ScheduleTimeWeight table

* 🚧 reload http module to test proxy

*  合并 main 的代码

* 🚧 在每次测试结束后关闭browser

* 🧑‍💻 在mcbbsnews渲染异常时添加logger

---------

Co-authored-by: hemengyang <hmy0119@gmail.com>
Co-authored-by: Azide <rukuy@qq.com>
This commit is contained in:
felinae98
2023-03-03 15:12:25 +08:00
committed by GitHub
parent bc521cd38a
commit 0201d5b316
13 changed files with 258 additions and 171 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ from datetime import time
from typing import Type
from nonebug import App
from pytest_mock import MockerFixture
if typing.TYPE_CHECKING:
from nonebot_bison.utils.scheduler_config import SchedulerConfig
@@ -60,7 +61,7 @@ async def test_scheduler_without_time(init_scheduler):
assert static_res["bilibili-live-t2"] == 3
async def test_scheduler_with_time(app: App, init_scheduler):
async def test_scheduler_with_time(app: App, init_scheduler, mocker: MockerFixture):
from nonebot_bison.config import config, db_config
from nonebot_bison.config.db_config import TimeWeightConfig, WeightConfig
from nonebot_bison.platform.bilibili import BilibiliSchedConf
@@ -93,7 +94,8 @@ async def test_scheduler_with_time(app: App, init_scheduler):
await init_scheduler()
app.monkeypatch.setattr(db_config, "_get_time", lambda: time(1, 30))
mocker.patch.object(db_config, "_get_time", return_value=time(1, 30))
static_res = await get_schedule_times(BilibiliSchedConf, 6)
assert static_res["bilibili-t1"] == 1
assert static_res["bilibili-t2"] == 2
@@ -104,7 +106,7 @@ async def test_scheduler_with_time(app: App, init_scheduler):
assert static_res["bilibili-t2"] == 2
assert static_res["bilibili-live-t2"] == 3
app.monkeypatch.setattr(db_config, "_get_time", lambda: time(10, 30))
mocker.patch.object(db_config, "_get_time", return_value=time(10, 30))
static_res = await get_schedule_times(BilibiliSchedConf, 6)
assert static_res["bilibili-t2"] == 6