Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A plugin which allows to compare results with canonical results, based on previous runs

Project description

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

A plugin which allows to compare results with canonical results, based on previous runs.


Inspired by Yandex’s canondata plugin, pytest-needle and pytest-regtest.

This pytest plugin was generated with Cookiecutter along with @hackebrot’s cookiecutter-pytest-plugin template.

TODO

  • Implement pytest’s hooks for asserts
  • Use pytest’s asserts for comparing objects
  • Driver for images
  • Driver for json
  • HTML reports for images

Installation

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

$ pip install pytest-canonical-data

Usage

Plugin provides canonical_data fixture, which allows to create canonical results:

def test_sth(canonical_data):
    # creates canonical result object with name `result.txt` and `text` driver
    canonical_result = canonical_data('result.txt', 'text')
    # In default mode will compare saved canonical result with `123` string
    # In canonize mode will save `123` as the canonical result
    canonical_result.assert_equal('123')

To run in canonize mode execute:

pytest --canonize

It will create files with canonical results (if don’t exist) and save actual results.

Drivers

You need to use appropriate driver for each data type. Currently, there are the following drivers:

  • bytes: for comparing bytes sequences.
  • str: for comparing python strings.
  • text: alias for the str driver.

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-canonical-data” 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-canonical-data, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pytest_canonical_data-0.1.0-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pytest-canonical-data-0.1.0.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page