MCPcopy Index your code
hub / github.com/nonebot/nonebot2 / test_run

Function test_run

tests/test_init.py:73–88  ·  view source on GitHub ↗
(monkeypatch: pytest.MonkeyPatch)

Source from the content-addressed store, hash-verified

71
72
73def test_run(monkeypatch: pytest.MonkeyPatch):
74 runned = False
75
76 def mock_run(*args, **kwargs):
77 nonlocal runned
78 runned = True
79 assert args == ("arg",)
80 assert kwargs == {"kwarg": "kwarg"}
81
82 driver = get_driver()
83
84 with monkeypatch.context() as m:
85 m.setattr(driver, "run", mock_run)
86 nonebot.run("arg", kwarg="kwarg")
87
88 assert runned
89
90
91def test_get_bot(app: App, monkeypatch: pytest.MonkeyPatch):

Callers

nothing calls this directly

Calls 2

get_driverFunction · 0.90
runMethod · 0.45

Tested by

no test coverage detected