一个pytest插件,用于将测试结果通知到不一致通道。

pytest-discord的Python项目详细描述


Summary

PyPI package versionSupported Python versionsSupported Python implementationsLinux/macOS/Windows CI status

一个pytest插件,用于将测试结果通知到不一致通道。在

Installation

pip install pytest-discord

Quick start

Usage

通过--discord-webhook选项执行pytest时设置webhook URL:

^{pr2}$
https://github.com/thombashi/pytest-discord/blob/master/ss/pytest-discord.png

通知消息示例

或者,将webhook URL设置为环境变量PYTEST_DISCORD_WEBHOOK

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

或者,您可以通过ini选项(稍后介绍)指定不一致频道的webhook URL。在

Increse the verbosity level

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

通知消息示例

通知消息可能会忽略由不一致限制引起的信息(特别是在发生错误时)。 您可以使用--discord-attach-file选项作为附加的降价文件获取完整的邮件

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, using
                        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-discord. 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/tox.ini/setup.cfg/pyproject.toml (pytest 6.0.0 or later)文件中的[pytest]ini选项:

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, using
                      verbosity level of pytest. defaults to 0.
discord_username (string):
                      name for a message. defaults to pytest-discord.
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 ^{tt9}$:
^{pr 7}$
Example of ^{tt7}$:
^{pr 8}$

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Android中Twitter共享的java xAuth身份验证?   带有@XmlAnyAttribute和方法的java Bug?(使用JAXB-RI)   安卓 ArrayAdapter导致java。lang.NullPointerException   java如何使用JExel从现有excel文件中删除工作表   java树映射随机停止正确返回值   使用switch和scanner类java使用用户选择   java JCalendar多天选择   Java文件zip正在创建损坏的文件   Ajax调用中的java未定义错误   java处理JSON更改信息的最佳方法   java JNI不适用于AppKit线程   java在运行时为JTable的特定行设置背景色   java如何在for循环中添加按钮?   java在getclass()方法之后强制转换对象