Restore a checkpoint in pytest
Project description
pytest-checkpoint
Overview
pytest-checkpoint is a plugin for the pytest testing framework that allows developers to restore their testing state from a checkpoint. This feature is particularly useful for long-running test suites, enabling you to pick up where you left off without having to rerun all tests.
Perfect for Interruptible Environments
Running long test suites can be challenging when your environment isn't guaranteed to be stable. For example:
- Your CI pipeline might time out
- Your development machine might need a reboot
- Your cloud instance might be interrupted (i.e. AWS Spot instances)
pytest-checkpoint automatically saves your test progress, so you can pick up exactly where you left off when the system comes back online. This saves valuable time and computing resources, especially in environments where interruptions are common.
Features
- Checkpoint Restoration: Automatically restore the state of tests from a previously saved checkpoint.
- Flexible Collection Behavior: Choose how tests are collected when restoring from a checkpoint (deselect or skip).
- Detailed Logging: Get insights into the checkpointing process with debug logs.
Installation
You can install pytest-checkpoint using pip:
pip install pytest-checkpoint
Usage
To use pytest-checkpoint, you need to add options to your pytest configuration. You can do this by adding the following lines to your pytest.ini or directly in the command line:
[pytest]
addopts =
-p pytest_checkpoint
--lap-out .pytest_checkpoint/lap.json
--collect-behavior skip
or
pytest -p pytest_checkpoint --lap-out .pytest_checkpoint/lap.json --collect-behavior skip
Command Line Options
--lap-out: Specify the output file to store lap information for recording a checkpoint. Default is.pytest_checkpoint/lap.json.--collect-behavior: Determines how tests are collected when a checkpoint is restored. Options aredeselectorskip.
Example
Run your tests as usual, and the plugin will handle the checkpointing automatically:
pytest
If a test fails or is skipped, the plugin will mark it accordingly in the checkpoint file.
Contributing
We welcome contributions from the community! To contribute to pytest-checkpoint, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your branch to your forked repository.
- Create a pull request describing your changes.
License
pytest-checkpoint is licensed under the MIT License. See the LICENSE file for more details.
Authors
- Nick Grisafi - njgrisafi@gmail.com
Acknowledgments
- Thanks to the pytest community for their support and contributions to the testing ecosystem.
For more information, please refer to the documentation or check the source code in this repository.
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
Built Distribution
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_checkpoint-0.1.2.tar.gz.
File metadata
- Download URL: pytest_checkpoint-0.1.2.tar.gz
- Upload date:
- Size: 173.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd282cabaa5928cebfc910032f446a0921ea06ca4a47b043152a12e10888d3ad
|
|
| MD5 |
f856f5cb840342154ec4875b60f13159
|
|
| BLAKE2b-256 |
43f22aab693df34fb110249683bb834fc8925ce49d33ce008d8fa1594b6ccb78
|
File details
Details for the file pytest_checkpoint-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pytest_checkpoint-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13359100207e5c65e1e11c0376c512aea738535d4f0993de89f0ec34f7dcbb6d
|
|
| MD5 |
67e6e2528d36b0850c318246c645b04d
|
|
| BLAKE2b-256 |
64dd337f5d2030004d1056d47b4a2bb2d9ccf99f5ff3babc18b5f97e4265dafb
|