Skip to main content

A plugin to use approvaltests with pytest

Project description

PyPI version Python versions See Build Status on Travis CI See Build Status on AppVeyor

A plugin to use approvaltests with pytest

Features

  • command line options to choose which reporter to use on approval test failure
  • define your own diff reporter to use on approval test failure

Requirements

approvaltests

Installation

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

$ pip install pytest-approvaltests

Usage

See also the documentation for approval tests

When your approval tests fail and you are working interactively, you might like it to open another diff tool than when you are on a CI server for example.

This plugin allows you to configure pytest with which diff tool to use when tests fail.

To set the default reporter to ‘PythonNative’, suitable for use on the command line:

pytest –approvaltests-use-reporter=’PythonNative’

To define your own diff reporter, perhaps a program with a rich GUI installed only on your developer workstation:

pytest –approvaltests-add-reporter=”diff_program”

The value for ‘approvaltests-add-reporter’ should be an executable program that can diff two files received as arguments on the command line like this:

diff_program filepath1 filepath2

if it takes additional arguments, add them with ‘approvaltests-add-reporter-args’:

pytest –approvaltests-add-reporter=”diff_program” –approvaltests-add-reporter-args=”arg1,arg2”

They will be inserted like this:

diff_program arg1 arg2 filepath1 filepath2

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, “pytest-approvaltests” 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.

Files for pytest-approvaltests, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pytest_approvaltests-0.1.1-py3.7.egg (4.7 kB) File type Egg Python version 3.7 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page