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@v3

    - uses: actions/setup-python@v4
      with:
        python-version: 3.8

    - 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

File details

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

File metadata

File hashes

Hashes for pytest_github_actions_annotate_failures-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d4c3177c98046c3900a7f8ddebb22ea54b9f6822201b5d3ab8fcdea51e010db7
MD5 78a63f746efe2fbd9d1e4158b8896ba1
BLAKE2b-256 39d4c54ee6a871eee4a7468e3a8c0dead28e634c0bc2110c694309dcb7563a66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_github_actions_annotate_failures-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41ea558ba10c332c0bfc053daeee0c85187507b2034e990f21e4f7e5fef044cf
MD5 2b9dd6ed07d34f007c9b150626c5fc08
BLAKE2b-256 6d737b0b15cb8605ee967b34aa1d949737ab664f94e6b0f1534e8339d9e64ab2

See more details on using hashes here.

Supported by

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