Skip to main content

Formatting PyTest output for Azure Pipelines UI

Project description

Build status PyPI version Python versions

Making Pytest easier to use with Microsoft Azure Pipelines.

Just run pytest with this plugin and see your test results in the Azure Pipelines UI!


Features:

  • Formats the PyTest output to show test docstrings and module names instead of just test case names in the Azure Pipelines UI.

  • Overloads the –junit-xml flag on execution with a default value

  • Uploads test results automatically, no need for a seperate test results upload command

  • Displays the number of failed tests if there were failures as an error message in the UI

https://github.com/tonybaloney/pytest-azurepipelines/raw/master/screenshot.png

Installation

You can install “pytest-azurepipelines” via pip from PyPI:

$ pip install pytest-azurepipelines

Usage

This plugin requires no configuration.

Here is an example of installing the plugin and running the tests.

- script: |
    python -m pip install --upgrade pip
    pip install pytest pytest-azurepipelines
    pip install -e .
  displayName: 'Install dependencies'

- script: |
    python -m pytest tests/
  displayName: 'pytest'

If you want to change the Azure Pipelines “Test Run Title”, you can provide the –test-run-title flag with the run title.

- script: |
    pip install pytest pytest-azurepipelines
    pytest tests/ --test-run-title="Windows Test with junitxml"
  displayName: 'pytest with junitxml flag'

If you have long docstrings in your functions and want them to be shortened, you can use the –napoleon-docstrings flag:

- script: |
   pip install pytest pytest-azurepipelines
   pytest tests/ --test-run-title="Windows Test with junitxml" --napoleon-docstrings

Contributing

Contributions are very welcome.

License

Distributed under the terms of the MIT license, “pytest-azurepipelines” is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

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

pytest-azurepipelines-0.5.0.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

pytest_azurepipelines-0.5.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

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