Skip to main content

pytest plugin to annotate failed tests with a workflow command for GitHub Actions

Project description

pytest-github-actions-annotate-failures

Pytest plugin to annotate failed tests with a workflow command for GitHub Actions

Usage

Just install and run pytest with this plugin in your workflow. For example,

name: test

on:
  push:

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - uses: actions/setup-python@v5
      with:
        python-version: 3.13

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Install plugin
      run: pip install pytest-github-actions-annotate-failures

    - run: pytest

If your test is running in a Docker container, you have to install this plugin and manually set GITHUB_ACTIONS environment variable to true inside of Docker container. (For example, docker-compose run --rm -e GITHUB_ACTIONS=true app -- pytest)

If your tests are run from a subdirectory of the git repository, you have to set the PYTEST_RUN_PATH environment variable to the path of that directory relative to the repository root in order for GitHub to identify the files with errors correctly.

Warning annotations

This plugin also supports warning annotations when used with Pytest 6.0+. To disable warning annotations, pass --exclude-warning-annotations to pytest.

Screenshot

Image from Gyazo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file pytest_github_actions_annotate_failures-0.4.2.tar.gz.

File metadata

File hashes

Hashes for pytest_github_actions_annotate_failures-0.4.2.tar.gz
Algorithm Hash digest
SHA256 5dd18304512361788bc7b5c5c805db853f03f4950c6be09b088de6bab8e2e6c9
MD5 ca2c86174ae473d34f96d256d7805ba2
BLAKE2b-256 00a0bdb91581b03c41016c78e16b8ec36c34d8508206fcb30f1951c9cdff2e97

See more details on using hashes here.

File details

Details for the file pytest_github_actions_annotate_failures-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_github_actions_annotate_failures-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 02911cd3b55f235328a334f8ca6037a89944398b8e8b028c82de97111eff4071
MD5 5e2dbfa86e397ae1b5bcce1de4744899
BLAKE2b-256 3c09c44e658f3a27c588c2017d858c8b0fa962612af9b74326beabbf010c839c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page