{"library":"pytest-messenger","title":"Pytest Messenger","description":"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.","language":"python","status":"active","last_verified":"Sat Apr 11","install":{"commands":["pip install pytest-messenger"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport pytest\n\n# To simulate a test run and trigger reporting\ndef test_example_success():\n    assert True\n\ndef test_example_failure():\n    assert False\n\n# To run this example:\n# 1. Create a virtual environment and install pytest-messenger:\n#    pip install pytest-messenger pytest\n# 2. Set your Slack webhook URL as an environment variable:\n#    export SLACK_WEBHOOK_URL='https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'\n# 3. (Optional) Set a Slack channel and username:\n#    export SLACK_CHANNEL='#test-reports'\n#    export SLACK_USERNAME='CI Bot'\n# 4. Save the above Python code as a test file (e.g., test_report.py).\n# 5. Run pytest with the plugin options (values are pulled from env vars):\n#    pytest test_report.py \\\n#        --slack_hook=\"${SLACK_WEBHOOK_URL}\" \\\n#        --slack_channel=\"${SLACK_CHANNEL:-#general}\" \\\n#        --slack_username=\"${SLACK_USERNAME:-Pytest Report}\"\n","lang":"bash","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}