Skip to main content

easy assertion with expected results saved to yaml files

Project description

PyPI version Python versions See Build Status on Github Actions See Build Status on Travis CI See Build Status on AppVeyor See Coverage on CodeCov

Easy assertion with expected results saved to yaml files.

Features

  • Creates yaml files for expected test results , a.k.a. tape.

  • Creates separate tape for each test file. Each tape stores results for all tests that have utilised tape fixture.

  • supports parametrized tests, as long as all parameters can be jsonified.

  • Hash functions are used to store and identify params.

  • Expected results are stored as dictionaries in yaml, so that they can be compared using tolerances.

Requirements

  • python >= 3.6

Installation

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

$ pip install pytest-tape

Usage

Just use tape fixture in any of the tests and assert dictionary of results with it.

def test_correctness(tape):
    result_of_calc = {
    'a': [1,2,3], 'b':'Another_Random_Result', 'c': 45.99
    }
    assert tape == result_of_calc

First time the tests fails, tape writes to yaml file. Second and all subsequent times you run the test - it compares the result with what is on tape.

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-tape” is free and open source software

Issues

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

Acknowledgments

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

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-tape-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file pytest-tape-0.1.0.tar.gz.

File metadata

  • Download URL: pytest-tape-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for pytest-tape-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ed813eb90376f5d9904a9e6db0108e5ecabb9b3c333eaa7aa8100d3f550d3ff
MD5 5b97f120bd304e52a7e8a84822c0fb7e
BLAKE2b-256 e2231490d4570fa889f95ec20b6ed30966e35a705336f2d6e3d63381a0e05776

See more details on using hashes here.

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