pytest plugin for snapshot regression testing
Project description
About
Introduction
pytest-regtest
is a plugin for pytest to implement regression testing.
Unlike functional testing, regression testing testing does not test whether the software produces the correct results, but whether it behaves as it did before changes were introduced.
More specifically, pytest-regtest
provides snapshot testing, which implements regression
testing by recording data within a test function and comparing this recorded output to a previously
recorded reference output.
Installation
To install and activate this plugin execute:
$ pip install pytest-regtest
Use case 1: Changing code with no or little testing setup yet
If you're working with code that has little or no unit testing, you can use regression testing to ensure that your changes don't break or alter previous results.
Example: This can be useful when working with scientific data analysis scripts, which often start a long script and then are restructured into different functions.
Use case 2: Testing complex data
If your unit tests contain a lot of assert
statements to check a complex data structure you can
use regression tests instead.
Example: To test code which ingests data into a database one can use regression tests on textual database dumps.
Use case 3: Testing numpy arrays or pandas data frames
If code produces numerical results, such as numpy
arrays or pandasdata frames, you can use
pytest-regtest` to simply record such results and test later with considering relative and
absolute tolerances.
Example: A function creates a 10 x 10 matrix. Either you have to write 100 assert statements or you use summary statistics to test your result. In both cases, you may get little debugging information if a test fails.
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 Distributions
Built Distribution
File details
Details for the file pytest_regtest-2.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_regtest-2.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d0fec970dfa217c5ebcb5299cfd3436e704a547bcbbe30c24f852cf89184abc |
|
MD5 | 0b42a726829bf2a446b8402f64076670 |
|
BLAKE2b-256 | 98a7cc1d1b047d1c382bf5c57aed1e0697ce4e04e5c09aee25acbb31f148b5ff |