Skip to content

Commit

Permalink
fix test due to merge mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
GuGuMur committed Dec 1, 2024
1 parent 308ffa0 commit 4a2c5c2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/platforms/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

def test_logger_custom_warning_enable(caplog):
from nonebot_bison.platform.platform import logger_custom_warning
from nonebot_bison.plugin_config import plugin_config

plugin_config.bison_collapse_network_warning = True
plugin_config.bison_collapse_network_warning_length = 100
Expand All @@ -37,6 +38,7 @@ def test_logger_custom_warning_enable(caplog):

def test_logger_custom_warning_disable(caplog):
from nonebot_bison.platform.platform import logger_custom_warning
from nonebot_bison.plugin_config import plugin_config

plugin_config.bison_collapse_network_warning = False
plugin_config.bison_collapse_network_warning_length = 100
Expand All @@ -49,6 +51,20 @@ def test_logger_custom_warning_disable(caplog):
"""
logger_custom_warning(test_message)

@pytest.mark.asyncio
async def test_catch_network_error_unmatched_exception(app: App, caplog):
from nonebot_bison.platform.platform import catch_network_error
from nonebot_bison.plugin_config import plugin_config

plugin_config.bison_collapse_network_warning = True

async def mock_exception():
raise Exception("unmatched exception")

result = await catch_network_error(mock_exception)

assert result is None
assert "unmatched exception: unmatched exception" in caplog.text

@pytest.fixture
def dummy_user(app: App):
Expand Down

0 comments on commit 4a2c5c2

Please sign in to comment.