<reponame>Sillocan/dpytest<filename>tests/conftest.py

import pytest
import discord
import discord.ext.commands as commands
import discord.ext.test as test


@pytest.fixture
def client(event_loop):
    c = discord.Client(loop=event_loop)
    test.configure(c)
    return c


@pytest.fixture
def bot(request, event_loop):
    b = commands.Bot("!", loop=event_loop)

    marks = request.function.pytestmark
    mark = None
    for mark in marks:
        if mark.name == "cogs":
            break

    if mark is not None:
        for extension in mark.args:
            b.load_extension("tests.internal." + extension)

    test.configure(b)
    return b
