pytest-messenger is a pytest plugin for sending test execution reports to various instant messaging platforms, including Slack, DingTalk, and Telegram. It streamlines communication for CI/CD pipelines and development teams by providing automated notifications of test outcomes. The library is actively maintained, with the current version being 3.3.0, and receives updates periodically.
pip install pytest-messengerNo compatibility data collected yet for this library.
To quickly get started with pytest-messenger, you typically configure it via command-line options or a `pytest.ini` file. This example demonstrates how to run pytest and report results to Slack using environment variables for sensitive data. Ensure your Slack webhook URL is correctly configured and accessible.
Uninstall `pytest-slack` (if present) and `pip install pytest-messenger`. Review the new documentation for specific command-line argument and `pytest.ini` key changes if you encounter issues.
Pass sensitive data via environment variables (e.g., `os.environ.get('SLACK_WEBHOOK_URL')`) and reference them in your `pytest` command or `pytest.ini` configuration. For example, `--slack_hook='${SLACK_WEBHOOK_URL}'`.Verify the webhook URL/token directly with your messenger platform's integration settings. Ensure it's active and correctly copied. Check the pytest output for any plugin-specific error messages that might indicate an issue with the API call.
Install `pytest-messenger` with the Slack extra: `pip install pytest-messenger[slack]`.
Verify that the API token and target channel/chat ID are correct, active, and have the required permissions configured in the respective messaging platform.
Ensure you activate the desired messenger using the appropriate command-line flag (e.g., `pytest --messenger-slack`) or set `messenger_slack = True` in your `pytest.ini` under the `[pytest]` section.