Booktest is a snapshot testing library for review driven testing.
Project description
Booktest
booktest is review-driven testing tool that combines Jupyterbook style data science development with traditional regression testing. Booktest is developed by Lumoa.me, the actionable feedback analytics platform.
booktest is designed to tackle a common problem with the data science RnD work flows and regression testing:
- Data science produces results such as probability estimates, which can be
good or bad, but not really right or wrong as in the traditional software engineering.
- Because the DS results are not strictly right or wrong, it's very difficult to use assertions for quality assurance and preventing regression.
- For example, you cannot really say that accuracy 0.84 is correct, while the accuracy 0.83 is incorrect, especially if you have other measurements (log likelihood) giving conflicting results. Neither evaluating a topic model as correct or incorrect is non-sensical. In practice, most data science applications require an expert review.
- This less ambigious quality also creates need for a better visibility of how the system behaves. One typically wants to print out edge cases and their diagnostics to see the behavior, see intermediate steps and see the results for different data sets .
- There is also the problem of the data science data being big and the intermediate
results being computationally expensive.
- Jupyter notebook deals with this problem by keeping the state in memory between runs, while traditional unittests tend to lose the program state between runs. This leads to very slow test runs, slow iteration speed and low productivity.
- While the Jupyter Notebook provides good visibility to results required by the expert review and powerful caching functionality: it fails short on a) often requiring copy-pasting production code to make results visible, b) it doesn't support automated regression testing and c) expert review requires expensive full review even if nothing changed.
booktest solves this problem setting by delivering on 3 main points:
- Focus on the results and analytic as in Jupyter notebook by allowing user to print the results as MD files.
- Keep the intermediate results cached either in memory or in filesystem by having two level cache.
- Instead of doing strict assertions, do testing by comparing old results with new results.
As such, booktest does snapshot testing, and it stores the snapshots in filesystem and in Git. Additional benefit of this approach is that you can trace the result development in Git.
Getting started guide
You can find getting started guide here
Workflows, coverage and CI
You can find guide on common workflows, coverage measurements and continuous integration here
Examples
Examples are found in the test example directory.
Example results are visible in the book index.
There is also separate example project
API reference
API reference is generated under docs directory. Main classes are:
- TestCaseRun, which provides API for tests
- TestBook, which provide a base class for test suite object
- TestSuite, which provide a base class for test suite object
- Tests, which manages CLI interface
Developing booktest
Development guide is available here
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 booktest-0.3.41.tar.gz
.
File metadata
- Download URL: booktest-0.3.41.tar.gz
- Upload date:
- Size: 34.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f69e9fa948260d29f18e535c6a642faea9500ffdde383f6c7743305ce84ed2e |
|
MD5 | 19aa57062feda2eaca83a3bd4969d6bf |
|
BLAKE2b-256 | 0932301f040a6ac3c9879fdf2566a1a475bcdcd99f1835fff0933d240fe68302 |
Provenance
The following attestation bundles were made for booktest-0.3.41.tar.gz
:
Publisher:
actions.yml
on lumoa-oss/booktest
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
booktest-0.3.41.tar.gz
- Subject digest:
1f69e9fa948260d29f18e535c6a642faea9500ffdde383f6c7743305ce84ed2e
- Sigstore transparency entry: 148317701
- Sigstore integration time:
- Predicate type:
File details
Details for the file booktest-0.3.41-py3-none-any.whl
.
File metadata
- Download URL: booktest-0.3.41-py3-none-any.whl
- Upload date:
- Size: 45.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1accd9977880c4d0dfdc44bdfad414e9e47173766bbb9cac25bb9f65ea0c7654 |
|
MD5 | 7a5e237a816cbe0610b940db4263e8c6 |
|
BLAKE2b-256 | a38cba155f204dac9d2db08aa058944b3451d3e89761390517cc2e28808c0cf5 |
Provenance
The following attestation bundles were made for booktest-0.3.41-py3-none-any.whl
:
Publisher:
actions.yml
on lumoa-oss/booktest
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
booktest-0.3.41-py3-none-any.whl
- Subject digest:
1accd9977880c4d0dfdc44bdfad414e9e47173766bbb9cac25bb9f65ea0c7654
- Sigstore transparency entry: 148317703
- Sigstore integration time:
- Predicate type: