23 lines
563 B
Python
23 lines
563 B
Python
import sys
|
|
from pathlib import Path
|
|
from unittest.mock import Mock
|
|
|
|
import pytest
|
|
from pytest_mock import MockerFixture
|
|
|
|
# Add source to PATH such that imports within src modules are properly resolved.
|
|
SRC_PATH = str(Path(__file__).parent / '..' / 'src')
|
|
sys.path.insert(0, SRC_PATH)
|
|
|
|
|
|
@pytest.fixture
|
|
def bot(mocker: MockerFixture):
|
|
bot_mock = mocker.patch('discord.ext.commands.Bot', autospec=True)
|
|
bot_mock.loop = Mock()
|
|
yield bot_mock
|
|
|
|
|
|
@pytest.fixture
|
|
def ctx(mocker: MockerFixture):
|
|
yield mocker.patch('discord.ext.commands.Context', autospec=True)
|