Skip to main content
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.

Release files for pytest-canonical-data 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-canonical-data 0.1.0
File Size Uploaded
pytest-canonical-data-0.1.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-canonical-data 0.1.0
File Interpreter ABI Platform
pytest_canonical_data-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / pytest-canonical-data-0.1.0.tar.gz

Download URL pytest-canonical-data-0.1.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ddabcfbd3e7dbfd929db7286c7fb708943bf68b5d8c92d6034423d14d17c380a
BLAKE2b-256 checksum
How to use checksums
8662df1ab41a11012a3a1e7a46b0780e39ced03e51734350e73a949b25e96b11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / pytest_canonical_data-0.1.0-py3-none-any.whl

Download URL pytest_canonical_data-0.1.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e14d1140774a47ee6f1e8b91943391960e86c6426efa50f0a15e3b6c9157a662
BLAKE2b-256 checksum
How to use checksums
31ea818b2962badfe983c0f14c772f2bcac041682e2938b83e047fbd64607a4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page