一个pytest插件,用于将测试结果通知到不一致通道。
pytest-discord的Python项目详细描述
pytest不一致
Installation
pip install pytest-discord
Quick start
Usage
通过--discord-webhook选项执行pytest时设置webhook URL:
^{pr2}$通知消息示例
或者,将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
通知消息示例
通知消息可能会忽略由不一致限制引起的信息(特别是在发生错误时)。 您可以使用--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}$ |
- 项目
标签: