Skip to main content

Restore a checkpoint in pytest

Project description

pytest-checkpoint

pytest-checkpoint Logo

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]
lap_out = .pytest_checkpoint/lap.json
collect_behavior = deselect  # or 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 are deselect or skip.

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:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your branch to your forked repository.
  5. Create a pull request describing your changes.

License

pytest-checkpoint is licensed under the MIT License. See the LICENSE file for more details.

Authors

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

pytest_checkpoint-0.1.1.tar.gz (173.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_checkpoint-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_checkpoint-0.1.1.tar.gz.

File metadata

  • Download URL: pytest_checkpoint-0.1.1.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

Hashes for pytest_checkpoint-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b6fa725b5ef4b58b9eb34057ccf6a2094fe694d98022cc803b98e4a703968aeb
MD5 5c77020776aba7f9719b471e38614ad2
BLAKE2b-256 8e22ba5cc7c5dc8cd69a227f6863c3cb4ebf2a7765673028a26d166434ce9254

See more details on using hashes here.

File details

Details for the file pytest_checkpoint-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_checkpoint-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 276404b6dbd08820b949b8c08c76c3f10e08244269ccd3b8627f8ea81d988b46
MD5 1dfbd8e5a8e746a3b02c99667d781b41
BLAKE2b-256 e4fe6468ddc81a61631e49b788bcbf5c88801b7bce91834496aee772fdcb1af3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page