From a0b98f5c9ca802bd91ee23e2ae19664ccdf06963 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Sun, 13 Feb 2022 22:02:12 +0800 Subject: [PATCH] update send test --- tests/test_send.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_send.py b/tests/test_send.py index 746d3f3..288e77f 100644 --- a/tests/test_send.py +++ b/tests/test_send.py @@ -32,6 +32,7 @@ async def test_send_no_queue(app: App): @pytest.mark.asyncio async def test_send_queue(app: App): import nonebot + from nonebot_bison import send from nonebot_bison.plugin_config import plugin_config from nonebot_bison.send import LAST_SEND_TIME, do_send_msgs, send_msgs @@ -50,7 +51,8 @@ async def test_send_queue(app: App): ctx.should_call_api( "send_group_msg", {"group_id": "1233", "message": "msg"}, True ) - LAST_SEND_TIME = 0 - await asyncio.sleep(2) + await do_send_msgs() + assert not ctx.wait_list.empty() + app.monkeypatch.setattr(send, "LAST_SEND_TIME", 0, True) await do_send_msgs() assert ctx.wait_list.empty()