pytest-discord


Namepytest-discord JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/thombashi/pytest-discord
SummaryA pytest plugin to notify test results to a Discord channel.
upload_time2024-05-11 14:39:44
maintainerNone
docs_urlNone
authorTsuyoshi Hombashi
requires_python>=3.8
licenseMIT License
keywords discord plugin pytest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. contents:: **pytest-discord**
   :backlinks: top
   :depth: 2


Summary
============================================
|PyPI pkg ver| |Supported Python ver| |Supported Python impl| |CI status| |Test coverage| |CodeQL|

.. |PyPI pkg ver| image:: https://badge.fury.io/py/pytest-discord.svg
    :target: https://badge.fury.io/py/pytest-discord
    :alt: PyPI package version

.. |Supported Python impl| image:: https://img.shields.io/pypi/implementation/pytest-discord.svg
    :target: https://pypi.org/project/pytest-discord
    :alt: Supported Python implementations

.. |Supported Python ver| image:: https://img.shields.io/pypi/pyversions/pytest-discord.svg
    :target: https://pypi.org/project/pytest-discord
    :alt: Supported Python versions

.. |CI status| image:: https://github.com/thombashi/pytest-discord/actions/workflows/ci.yml/badge.svg
    :target: https://github.com/thombashi/pytest-discord/actions/workflows/ci.yml
    :alt: CI status of Linux/macOS/Windows

.. |Test coverage| image:: https://coveralls.io/repos/github/thombashi/pytest-discord/badge.svg?branch=master
    :target: https://coveralls.io/github/thombashi/pytest-discord?branch=master
    :alt: Test coverage: coveralls

.. |CodeQL| image:: https://github.com/thombashi/pytest-discord/actions/workflows/github-code-scanning/codeql/badge.svg
    :target: https://github.com/thombashi/pytest-discord/actions/workflows/github-code-scanning/codeql
    :alt: CodeQL

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 <https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>`__


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

::

    $ pytest --discord-webhook=<https://discordapp.com/api/webhooks/...>

.. figure:: https://cdn.jsdelivr.net/gh/thombashi/pytest-discord@master/ss/pytest-discord.png
    :scale: 80%
    :alt: 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

.. figure:: https://cdn.jsdelivr.net/gh/thombashi/pytest-discord@master/ss/pytest-discord_verbose.png
    :scale: 80%
    :alt: 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``:
    .. code-block:: toml

        [tool.pytest.ini_options]
        discord_webhook = "https://discordapp.com/api/webhooks/..."
        md_report_verbose = 1

:Example of ``setup.cfg``:
    .. code-block:: ini

        [tool:pytest]
        discord_webhook = https://discordapp.com/api/webhooks/...
        md_report_verbose = 1


Dependencies
============================================
- Python 3.8+
- `Python package dependencies (automatically installed) <https://github.com/thombashi/pytest-discord/network/dependencies>`__

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thombashi/pytest-discord",
    "name": "pytest-discord",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "discord, plugin, pytest",
    "author": "Tsuyoshi Hombashi",
    "author_email": "tsuyoshi.hombashi@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ab/47/af777f9c6369c28222dfe8bd409ef85c3a9f9314ddd23ba113af03a94d13/pytest_discord-0.2.0.tar.gz",
    "platform": null,
    "description": ".. contents:: **pytest-discord**\n   :backlinks: top\n   :depth: 2\n\n\nSummary\n============================================\n|PyPI pkg ver| |Supported Python ver| |Supported Python impl| |CI status| |Test coverage| |CodeQL|\n\n.. |PyPI pkg ver| image:: https://badge.fury.io/py/pytest-discord.svg\n    :target: https://badge.fury.io/py/pytest-discord\n    :alt: PyPI package version\n\n.. |Supported Python impl| image:: https://img.shields.io/pypi/implementation/pytest-discord.svg\n    :target: https://pypi.org/project/pytest-discord\n    :alt: Supported Python implementations\n\n.. |Supported Python ver| image:: https://img.shields.io/pypi/pyversions/pytest-discord.svg\n    :target: https://pypi.org/project/pytest-discord\n    :alt: Supported Python versions\n\n.. |CI status| image:: https://github.com/thombashi/pytest-discord/actions/workflows/ci.yml/badge.svg\n    :target: https://github.com/thombashi/pytest-discord/actions/workflows/ci.yml\n    :alt: CI status of Linux/macOS/Windows\n\n.. |Test coverage| image:: https://coveralls.io/repos/github/thombashi/pytest-discord/badge.svg?branch=master\n    :target: https://coveralls.io/github/thombashi/pytest-discord?branch=master\n    :alt: Test coverage: coveralls\n\n.. |CodeQL| image:: https://github.com/thombashi/pytest-discord/actions/workflows/github-code-scanning/codeql/badge.svg\n    :target: https://github.com/thombashi/pytest-discord/actions/workflows/github-code-scanning/codeql\n    :alt: CodeQL\n\nA pytest plugin to notify test results to a Discord channel.\n\n\nInstallation\n============================================\n::\n\n    pip install pytest-discord\n\n\nQuick start\n============================================\n\nMaking a Discord webhook\n--------------------------------------------\n`Intro to Webhooks \u2013 Discord <https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>`__\n\n\nUsage\n--------------------------------------------\nSet a webhook URL when executing ``pytest`` via ``--discord-webhook`` option:\n\n::\n\n    $ pytest --discord-webhook=<https://discordapp.com/api/webhooks/...>\n\n.. figure:: https://cdn.jsdelivr.net/gh/thombashi/pytest-discord@master/ss/pytest-discord.png\n    :scale: 80%\n    :alt: https://github.com/thombashi/pytest-discord/blob/master/ss/pytest-discord.png\n\n    Notification message example\n\nOr, set a webhook URL to an environment variable ``PYTEST_DISCORD_WEBHOOK``:\n\n::\n\n    $ export PYTEST_DISCORD_WEBHOOK=<https://discordapp.com/api/webhooks/...>\n    $ pytest\n\nOr, you can specify a webhook URL of a discord channel via ``ini-options`` (described later).\n\n\nIncrease the verbosity level\n--------------------------------------------\n::\n\n    $ pytest --discord-verbose=1\n\n.. figure:: https://cdn.jsdelivr.net/gh/thombashi/pytest-discord@master/ss/pytest-discord_verbose.png\n    :scale: 80%\n    :alt: https://github.com/thombashi/pytest-discord/blob/master/ss/pytest-discord_verbose.png\n\n    Notification message example\n\nNotification messages may omit information caused by Discord limitations (especially when errors occur).\nYou can get full messages as an attached markdown file with ``--discord-attach-file`` option.\n\n\nOptions\n============================================\n\nCommand options\n--------------------------------------------\n::\n\n    notify test results to a discord channel:\n      --discord-webhook=WEBHOOK_URL\n                            discord webhook url of a discord channel to notify pytest results. you can also specify the value with PYTEST_DISCORD_WEBHOOK environment variable.\n      --discord-verbose=VERBOSITY_LEVEL\n                            Verbosity level for pytest-discord.\n                            If not set, use the verbosity level of pytest.\n                            Defaults to 0.\n                            you can also specify the value with PYTEST_DISCORD_VERBOSE environment variable.\n      --discord-username=DISCORD_USERNAME\n                            name for a message. defaults to pytest. you can also specify the value with PYTEST_DISCORD_USERNAME environment variable.\n      --discord-success-icon=ICON_URL\n                            url to an icon of a successful run. you can also specify the value with PYTEST_DISCORD_SUCCESS_ICON environment variable.\n      --discord-skip-icon=ICON_URL\n                            url to an icon of a skipped run. you can also specify the value with PYTEST_DISCORD_SKIP_ICON environment variable.\n      --discord-fail-icon=ICON_URL\n                            url to an icon of a failed run. you can also specify the value with PYTEST_DISCORD_FAIL_ICON environment variable.\n      --discord-attach-file\n                            post pytest results as a markdown file to a discord channel. you can also specify the value with PYTEST_DISCORD_ATTACH_FILE environment variable.\n\n\nini-options\n--------------------------------------------\n[pytest] ini-options in the first ``pytest.ini``/``tox.ini``/``setup.cfg``/``pyproject.toml (pytest 6.0.0 or later)`` file found:\n\n::\n\n  discord_webhook (string):\n                        discord webhook url of a discord channel to notify pytest results.\n  discord_verbose (string):\n                        Verbosity level for pytest-discord. If not set, use the verbosity level of pytest. Defaults to 0.\n  discord_username (string):\n                        name for a message. defaults to pytest.\n  discord_success_icon (string):\n                        url to an icon of a successful run.\n  discord_skip_icon (string):\n                        url to an icon of a skipped run.\n  discord_fail_icon (string):\n                        url to an icon of a failed run.\n  discord_attach_file (bool):\n                        post pytest results as a markdown file to a discord channel.\n\n:Example of ``pyproject.toml``:\n    .. code-block:: toml\n\n        [tool.pytest.ini_options]\n        discord_webhook = \"https://discordapp.com/api/webhooks/...\"\n        md_report_verbose = 1\n\n:Example of ``setup.cfg``:\n    .. code-block:: ini\n\n        [tool:pytest]\n        discord_webhook = https://discordapp.com/api/webhooks/...\n        md_report_verbose = 1\n\n\nDependencies\n============================================\n- Python 3.8+\n- `Python package dependencies (automatically installed) <https://github.com/thombashi/pytest-discord/network/dependencies>`__\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A pytest plugin to notify test results to a Discord channel.",
    "version": "0.2.0",
    "project_urls": {
        "Changelog": "https://github.com/thombashi/pytest-discord/releases",
        "Homepage": "https://github.com/thombashi/pytest-discord",
        "Source": "https://github.com/thombashi/pytest-discord",
        "Tracker": "https://github.com/thombashi/pytest-discord/issues"
    },
    "split_keywords": [
        "discord",
        " plugin",
        " pytest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "672ff496610119e88acc50515dfda1e8adff4e231dadaf8b61074aff511b1f75",
                "md5": "e073c3894f0654bb9e83c586e41b603e",
                "sha256": "d94ff53b7b7f95f9a427ba81494494bc9df04c236e9824bb56da91669ff35217"
            },
            "downloads": -1,
            "filename": "pytest_discord-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e073c3894f0654bb9e83c586e41b603e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10378,
            "upload_time": "2024-05-11T14:39:42",
            "upload_time_iso_8601": "2024-05-11T14:39:42.183162Z",
            "url": "https://files.pythonhosted.org/packages/67/2f/f496610119e88acc50515dfda1e8adff4e231dadaf8b61074aff511b1f75/pytest_discord-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab47af777f9c6369c28222dfe8bd409ef85c3a9f9314ddd23ba113af03a94d13",
                "md5": "ac1a25476404909d45806de5e73c7ee1",
                "sha256": "bda52946adb3e5085bf3603d2df374ae25245f82dbd17b967f867a8bcd3ca77b"
            },
            "downloads": -1,
            "filename": "pytest_discord-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ac1a25476404909d45806de5e73c7ee1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 59067,
            "upload_time": "2024-05-11T14:39:44",
            "upload_time_iso_8601": "2024-05-11T14:39:44.038105Z",
            "url": "https://files.pythonhosted.org/packages/ab/47/af777f9c6369c28222dfe8bd409ef85c3a9f9314ddd23ba113af03a94d13/pytest_discord-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-11 14:39:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thombashi",
    "github_project": "pytest-discord",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pytest-discord"
}
        
Elapsed time: 2.55227s