A plugin which allows to compare results with canonical results, based on previous runs
Project description
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
Release history Release notifications | RSS feed
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-canonical-data-0.1.0.tar.gz
.
File metadata
- Download URL: pytest-canonical-data-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddabcfbd3e7dbfd929db7286c7fb708943bf68b5d8c92d6034423d14d17c380a |
|
MD5 | 18cdb87969ea17b160cd116eabbd4252 |
|
BLAKE2b-256 | 8662df1ab41a11012a3a1e7a46b0780e39ced03e51734350e73a949b25e96b11 |
File details
Details for the file pytest_canonical_data-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pytest_canonical_data-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e14d1140774a47ee6f1e8b91943391960e86c6426efa50f0a15e3b6c9157a662 |
|
MD5 | 54cd2523f05cd4ffd2306b1ac1f2bb16 |
|
BLAKE2b-256 | 31ea818b2962badfe983c0f14c772f2bcac041682e2938b83e047fbd64607a4e |