Skip to main content

pytest-notifier

PyPI Python License

English | Русский

A pytest plugin that sends notifications about failed tests to different channels (Console, Mattermost, Telegram).

Features

  • Notifications when tests fail.
  • Support for multiple channels at once.
  • Flexible configuration through environment variables or .env files.
  • Detailed error information, including tracebacks.
  • Custom messages appended to notifications (for Telegram and Mattermost).

Installation

Requires Python 3.13 or later.

pip install cloudru-qa-pytest-notifier

Import the plugin as the pytest_notifier module.

Skills for AI agents

This library does not have its own skill yet. If your project has other libraries from this collection with skills for AI agents, select and install them from the project root (requires uv):

uvx library-skills

For Claude Code, add --claude.

Usage

The plugin activates automatically when running pytest if installed.

Configuration

Configure it through environment variables. All variables use the PYTEST_NOTIFIER_ prefix.

Main settings

PYTEST_NOTIFIER_DESTINATIONS is the main variable specifying notification destinations (a bitmask).

Calculating DESTINATIONS

Add the flags for the required channels:

Channel Flag value
Console 1
Mattermost 2
Telegram 4

Example combinations:

Combination Calculation Result
Console only 1 1
Mattermost only 2 2
Telegram only 4 4
Console + Mattermost 1 + 2 3
Console + Telegram 1 + 4 5
Mattermost + Telegram 2 + 4 6
All channels 1 + 2 + 4 7

Mattermost

Variable Description
PYTEST_NOTIFIER_MATTERMOST__WEBHOOK_URL Webhook URL for sending messages.
PYTEST_NOTIFIER_MATTERMOST__USERNAME Bot name.
PYTEST_NOTIFIER_MATTERMOST__CHANNEL Channel to send messages to.
PYTEST_NOTIFIER_MATTERMOST__ICON_EMOJI Bot icon emoji (optional, for example :ghost:).
PYTEST_NOTIFIER_MATTERMOST__TIMEOUT_SECONDS Request timeout in seconds. Default: 10 seconds.
PYTEST_NOTIFIER_MATTERMOST__SEND_TRACEBACK Whether to send the error traceback: true or false. Default: true.
PYTEST_NOTIFIER_MATTERMOST__ADDITIONAL_MESSAGE Extra message appended to the notification.

Telegram

Variable Description
PYTEST_NOTIFIER_TELEGRAM__BOT_TOKEN Your bot's token.
PYTEST_NOTIFIER_TELEGRAM__CHAT_ID Chat or channel ID to send messages to.
PYTEST_NOTIFIER_TELEGRAM__TIMEOUT_SECONDS Request timeout in seconds. Default: 10.0.
PYTEST_NOTIFIER_TELEGRAM__SEND_TRACEBACK Whether to send the error traceback: true or false. Default: true.
PYTEST_NOTIFIER_TELEGRAM__ADDITIONAL_MESSAGE Extra message appended to the notification.

Example .env file

# Enable Mattermost and Telegram (2 + 4 = 6)
PYTEST_NOTIFIER_DESTINATIONS=6

# Mattermost
PYTEST_NOTIFIER_MATTERMOST__WEBHOOK_URL=https://mattermost.example.com/hooks/xxx
PYTEST_NOTIFIER_MATTERMOST__USERNAME=TestBot
PYTEST_NOTIFIER_MATTERMOST__CHANNEL=qa-alerts
PYTEST_NOTIFIER_MATTERMOST__ADDITIONAL_MESSAGE="Documentation: https://docs.example.com"

# Telegram
PYTEST_NOTIFIER_TELEGRAM__BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
PYTEST_NOTIFIER_TELEGRAM__CHAT_ID=-1001234567890
PYTEST_NOTIFIER_TELEGRAM__SEND_TRACEBACK=false
PYTEST_NOTIFIER_TELEGRAM__ADDITIONAL_MESSAGE="Contact the QA team for details"

Development

The plugin is developed in the qa-libraries monorepo alongside the other cloudru-qa-* libraries. You need uv, GNU Make, and checkmake. Run commands from the repository root:

make sync                        # install dependencies for all libraries from uv.lock
make test-pytest-notifier        # tests for this plugin
make typecheck-pytest-notifier   # mypy for this plugin
make check                       # formatting, ruff, mypy, and tests for the entire workspace

The plugin loads in every monorepo test run, so make always sets PYTEST_NOTIFIER_DESTINATIONS=1: notifications go only to the console, even if .env configures Mattermost or Telegram.

Tests run on Python 3.13 and 3.14. Create a separate environment for another version: make sync test-pytest-notifier PYTHON_VERSION=3.14.

Publish a release with the git tag pytest-notifier/v<version>. The tag version must match the version in packages/pytest-notifier/pyproject.toml.

Metadata

Release files for cloudru-qa-pytest-notifier 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudru-qa-pytest-notifier 1.0.0
File Size Uploaded Provenance Actions
cloudru_qa_pytest_notifier-1.0.0.tar.gz 13.2 kB With provenance Details for cloudru_qa_pytest_notifier-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloudru-qa-pytest-notifier 1.0.0
File Interpreter ABI Platform Actions
cloudru_qa_pytest_notifier-1.0.0-py3-none-any.whl Python 3 none any Details for cloudru_qa_pytest_notifier-1.0.0-py3-none-any.whl

Total release size: 28.1 kB

Release files / cloudru_qa_pytest_notifier-1.0.0.tar.gz

Download URL cloudru_qa_pytest_notifier-1.0.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6faa19ca85e148d0229bd81980a4927eddf4fec9502b065d85e6620af6c4347d
BLAKE2b-256 checksum
How to use checksums
73b4cd193877e2fb1a793e4e5483b4528196a798e93f3aedabf2a4441d234e3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / cloudru_qa_pytest_notifier-1.0.0-py3-none-any.whl

Download URL cloudru_qa_pytest_notifier-1.0.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
417687b0842338edc09ad991ad67ea1da39465202158f61b67f38d7188da3873
BLAKE2b-256 checksum
How to use checksums
6cab5b4ba180ac1b14b0ca47b26c9d57bb123889c52b2e9f9292e9bd81513c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for cloudru-qa-pytest-notifier 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cloudru_qa_pytest_notifier-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page