Test caching plugin for pytest
Project description
DryCI - Test caching system
This pytest plugin speeds up test runs by caching test results. It calculates a hash of the contents of all files that might affect the test results, and looks up the result in a central server.
This repository contains both the pytest plugin and a reference server.
This solution is a lightweight alternative to the test-caching part of heavy hermetic build systems like Bazel or Buck. It is designed to be easy to set up and use, and to work with existing projects without requiring full-time engineers to manage it.
User documentation, a public cache server, a hermeticity verifier, and more language support might come in the future.
How to use
- Add the
pytest-drycipackage to your dev-dependencies. - Configure
repo_dagger.yaml, see example_project for inspiration. - Obtain a DryCI token for a DryCI server. The public instance is currently in closed beta, but you may deploy your own.
- Run
DRYCI_TOKEN=$your_token_here pytest --dryci ./tests.
You may also specify DRYCI_SERVER to use a custom server, DRYCI_SALT to do cache-busting, and DRYCI_TIMEOUT to control http timeouts.
How it works
The plugin runs repo_dagger to analyze the runtime dependencies of all files that might affect the test results. To do this effectively, you will need to configure rules that define dependencies between files in repo_dagger.yaml. See example_config.toml for an example config.
Then, for each file in the test suite, it traverses the dependency graph and hashes each file. The hash of all these files is known as the "dependency hash" of the test file. The hash also includes some info about the system, such as the operating system, distro, architecture, and the contents of the DRYCI_SALT environment variable.
It then queries the server for the list of passed tests for each dependency hash, and skips any tests it returns. Test identifiers (pytest nodeids) are salted and hashed for privacy.
Note that failed tests are never cached, so flaky tests get a chance to run again. Skipped tests are also not cached, but that might change in the future.
After running the test suite, we upload the (hashed) identifier of each test that passed, so future runs can skip them.
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 Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_dryci-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl.
File metadata
- Download URL: pytest_dryci-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac7882944922ae336c9051d4dab4ec4ee1bfc4a86267ec70dd751f8871e12038
|
|
| MD5 |
b0fcb7e25267a35a3c41da9d1078eb5d
|
|
| BLAKE2b-256 |
3f2dac325f93a5ac46d912d23bad80f85c16aeec0b938fc0fd61e0f187b7e054
|
File details
Details for the file pytest_dryci-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl.
File metadata
- Download URL: pytest_dryci-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64, musllinux: musl 1.1+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08760412ead53d884560d674f7988b63230fd24570ec41bf8d8ca2a9cfe50545
|
|
| MD5 |
9f559162de7e21d4332a2cfb078c7909
|
|
| BLAKE2b-256 |
11f2cca7589dbc97e176083726c3c057a61db6d8a7b57ffd4b121662196ab489
|
File details
Details for the file pytest_dryci-0.1.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: pytest_dryci-0.1.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d26177aaba653b8ef0a54b89b04d6ba88166bae28d68788d8ccd8a146424e709
|
|
| MD5 |
27015917c3801bc7305523572484a033
|
|
| BLAKE2b-256 |
d51053a7312e4c13deccf6020d95614d0e9d973330110ba5809eee545d505b63
|
File details
Details for the file pytest_dryci-0.1.1-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pytest_dryci-0.1.1-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7580d4ea3194904f2a610673809939e83a90467a7283bbe4ddbc3f08c0e53f6e
|
|
| MD5 |
3b5bd4c13b2e2229cbb73c1ae5957f07
|
|
| BLAKE2b-256 |
11a3245ee1d22570e7b0bb3542cd3162391cf1b1a5419ae6b91aceea7241208a
|