Proper cleanup after tests
This commit is contained in:
parent
ac6b8783ba
commit
247fb5a6d4
|
@ -1,3 +1,4 @@
|
|||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock
|
||||
|
@ -23,8 +24,17 @@ def bot(mocker: MockerFixture):
|
|||
def mbot(bot):
|
||||
mbot_mock = Music(bot)
|
||||
yield mbot_mock
|
||||
mbot_mock.cog_unload()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def ctx(mocker: MockerFixture):
|
||||
yield mocker.patch('discord.ext.commands.Context', autospec=True)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def event_loop():
|
||||
loop = asyncio.get_event_loop()
|
||||
yield loop
|
||||
pending = asyncio.all_tasks(loop=loop)
|
||||
asyncio.ensure_future(asyncio.gather(*pending))
|
||||
|
|
Loading…
Reference in New Issue