Git Product home page Git Product logo

dpytest's Introduction

dpytest

Build Status Documentation Status

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

Documentation

Documentation can be found at dpytest.readthedocs.io, including examples and tutorials

Usage

TODO: Move this to RTD

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


@pytest.mark.asyncio
async def test_bot():
    bot = yourbot.BotClass()
    
    # Load any extensions/cogs you want to in here
    
    dpytest.configure(bot)
    
    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.

dpytest's People

Contributors

craftspider avatar bravosierra99 avatar sergeileduc avatar jaydwee avatar audrow avatar gsakul avatar dependabot[bot] avatar

Stargazers

 avatar Zofia avatar Lucas Villeneuve avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.