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.0.tar.gz.

File metadata

File hashes

Hashes for pytest_github_actions_annotate_failures-0.4.0.tar.gz
Algorithm Hash digest
SHA256 77d6baa29c8c61c2dacc494fa76eb95a185f0ee61666714ac43fb12ea672d217
MD5 1becab0f6828cf811d173b20f9d8e2d2
BLAKE2b-256 c2e18f2c242e6d75a26a8e5ddcc23f652a411e4aac3eedc4b923808ac0582685

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_github_actions_annotate_failures-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 285fed86e16b0b7a8eac6acdcde31913798fb739b15ef5b86895b4f5e32bf237
MD5 4a135337b58cf931110b604892d830f7
BLAKE2b-256 0fbd11809f5c78d5d8da2d0e004845d2382768bc20798b3e0988bca61efd349f

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