Skip to content

Commit 3b74a1b

Browse files
committed
Fix bot client tests
1 parent 3b5ff6e commit 3b74a1b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cloudbot/bot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,6 @@ def add_hook(hook, _event):
419419
tasks.sort(key=lambda t: t[0].priority)
420420

421421
for _hook, _event in tasks:
422-
async_util.wrap_future(self.plugin_manager.launch(_hook, _event))
422+
async_util.wrap_future(
423+
self.plugin_manager.launch(_hook, _event), loop=self.loop
424+
)

tests/core_tests/irc_client_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def wait_tasks(self, conn, cancel=False):
4646
task.cancel()
4747

4848
try:
49-
conn.loop.run_until_complete(asyncio.gather(*tasks))
49+
conn.loop.run_until_complete(asyncio.gather(*tasks, loop=conn.loop))
5050
except CancelledError:
5151
if not cancel:
5252
raise # pragma: no cover
@@ -61,7 +61,7 @@ def make_proto(self):
6161
conn.loop = asyncio.get_event_loop_policy().new_event_loop()
6262
out = []
6363

64-
async def func(e):
64+
def func(e):
6565
out.append(self._filter_event(e))
6666

6767
conn.bot.process = func
@@ -133,6 +133,8 @@ def test_broken_line_doesnt_interrupt(self, caplog):
133133

134134
self.wait_tasks(conn)
135135

136+
assert len(out) == 2
137+
136138
assert out == [
137139
{
138140
"chan": "server\x02.host",

0 commit comments

Comments
 (0)