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.


  • 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.


  • python >= 3.6


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

$ pip install pytest-tape


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.


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.


Distributed under the terms of the MIT license, “pytest-tape” is free and open source software


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


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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-tape, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pytest-tape-0.1.0.tar.gz (5.6 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