Skip to main content

A package that assists in writing tests for

Project description


This is a package to allow testing of It is only compatible with the rewrite version, and is still in early alpha. It relies on pytest-asyncio for asynchronous test running, as is coroutine driven.


dpytest can be used for projects using the default commands.Bot, or those defining their own subclass of bot. For someone using a custom class, code would look something like this:

import discord.ext.test as dpytest
import yourbot
import pytest

async def test_bot():
    bot = yourbot.BotClass()

    # Load any extensions/cogs you want to in here


    await dpytest.message("!help")
    dpytest.verify_message("[Expected help output]")

The dpytest framework is designed to be used best with pytest style fixtures, but is technically framework agnostic.
With pytest, the bot setup step would be moved into a fixture so each test could use that fixture. Configure will ensure that all state is reset after each call.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dpytest, version 0.0.15
Filename, size File type Python version Upload date Hashes
Filename, size dpytest-0.0.15-py3-none-any.whl (12.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size dpytest-0.0.15.tar.gz (11.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page