Skip to main content

A pytest plugin to notify test results to a Discord channel.

Project description

Summary

PyPI package version Supported Python versions Supported Python implementations Linux/macOS/Windows CI status Test coverage: coveralls

A pytest plugin to notify test results to a Discord channel.

Installation

pip install pytest-discord

Quick start

Making a Discord webhook

Intro to Webhooks – Discord

Usage

Set a webhook URL when executing pytest via --discord-webhook option:

$ pytest --discord-webhook=<https://discordapp.com/api/webhooks/...>
https://github.com/thombashi/pytest-discord/blob/master/ss/pytest-discord.png

Notification message example

Or, set a webhook URL to an environment variable PYTEST_DISCORD_WEBHOOK:

$ export PYTEST_DISCORD_WEBHOOK=<https://discordapp.com/api/webhooks/...>
$ pytest

Or, you can specify a webhook URL of a discord channel via ini-options (described later).

Increase the verbosity level

$ pytest --discord-verbose=1
https://github.com/thombashi/pytest-discord/blob/master/ss/pytest-discord_verbose.png

Notification message example

Notification messages may omit information caused by Discord limitations (especially when errors occur). You can get full messages as an attached markdown file with --discord-attach-file option.

Options

Command options

notify test results to a discord channel:
  --discord-webhook=WEBHOOK_URL
                        discord webhook url of a discord channel to notify pytest results. you can also specify the value with PYTEST_DISCORD_WEBHOOK environment variable.
  --discord-verbose=VERBOSITY_LEVEL
                        Verbosity level for pytest-discord.
                        If not set, use the verbosity level of pytest.
                        Defaults to 0.
                        you can also specify the value with PYTEST_DISCORD_VERBOSE environment variable.
  --discord-username=DISCORD_USERNAME
                        name for a message. defaults to pytest. you can also specify the value with PYTEST_DISCORD_USERNAME environment variable.
  --discord-success-icon=ICON_URL
                        url to an icon of a successful run. you can also specify the value with PYTEST_DISCORD_SUCCESS_ICON environment variable.
  --discord-skip-icon=ICON_URL
                        url to an icon of a skipped run. you can also specify the value with PYTEST_DISCORD_SKIP_ICON environment variable.
  --discord-fail-icon=ICON_URL
                        url to an icon of a failed run. you can also specify the value with PYTEST_DISCORD_FAIL_ICON environment variable.
  --discord-attach-file
                        post pytest results as a markdown file to a discord channel. you can also specify the value with PYTEST_DISCORD_ATTACH_FILE environment variable.

ini-options

[pytest] ini-options in the first pytest.ini/tox.ini/setup.cfg/pyproject.toml (pytest 6.0.0 or later) file found:

discord_webhook (string):
                      discord webhook url of a discord channel to notify pytest results.
discord_verbose (string):
                      Verbosity level for pytest-discord. If not set, use the verbosity level of pytest. Defaults to 0.
discord_username (string):
                      name for a message. defaults to pytest.
discord_success_icon (string):
                      url to an icon of a successful run.
discord_skip_icon (string):
                      url to an icon of a skipped run.
discord_fail_icon (string):
                      url to an icon of a failed run.
discord_attach_file (bool):
                      post pytest results as a markdown file to a discord channel.
Example of pyproject.toml:
[tool.pytest.ini_options]
discord_webhook = "https://discordapp.com/api/webhooks/..."
md_report_verbose = 1
Example of setup.cfg:
[tool:pytest]
discord_webhook = https://discordapp.com/api/webhooks/...
md_report_verbose = 1

Dependencies

Project details


Download files

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

Source Distribution

pytest-discord-0.1.5.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

pytest_discord-0.1.5-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest-discord-0.1.5.tar.gz.

File metadata

  • Download URL: pytest-discord-0.1.5.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pytest-discord-0.1.5.tar.gz
Algorithm Hash digest
SHA256 fb8c5ad5cbc60ef116c61c7a8bb15ea114fba107c92c1de0cc659883a8191821
MD5 16bb32b3c958d0fae491ea6051eac272
BLAKE2b-256 fbe1d7b22f5f6be11d5a25156a5a5e95be44137d68e7144b9ee5919371053cfe

See more details on using hashes here.

File details

Details for the file pytest_discord-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_discord-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 41787f8cc8ff55f108f693188fd0cc1bdb1fe4f217456b99bd884cad1e556ace
MD5 66701147e072396b4097261ca7cdf590
BLAKE2b-256 221491dac8fcd19baad672fb72f7b01da06140f6e09f40e9f25b88f6ef07f86b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page