The cream of test execution - smooth pytest workflows with intelligent orchestration
Project description
pytest-cream
Intelligent test orchestration for pytest. Splits tests by duration and runs them efficiently - long tests sequentially, short tests in parallel.
Installation
pip install pytest-cream
Quick Start
# Initialize: fetch tests and install dependencies
pytest-cream init --repo owner/project
# Profile: collect test durations
pytest-cream profile
# Run: execute with intelligent orchestration
pytest-cream run
The workspace is saved to .pytest-cream.json after init, so subsequent commands just work.
Common Options
# Run only fast tests (skip slow ones)
pytest-cream run --short-only
# Limit number of tests
pytest-cream run --limit 50
# Adjust threshold for long/short split (default: 0.5s)
pytest-cream run --threshold 0.3
# Set parallel workers (default: 4)
pytest-cream run --workers 8
# Exclude test patterns
pytest-cream run --exclude-tests "test_integration/,test_slow.py"
# Combine options
pytest-cream run --short-only --limit 30 --workers 8
How It Works
profileruns all tests and records their durationsrunsplits tests by duration threshold- Long tests run sequentially (cache warming)
- Short tests run in parallel (pytest-xdist)
Commands
init
Fetch tests from a repository and install dependencies.
pytest-cream init --repo owner/project [--branch main] [--ws path]
Uses current directory by default. Warns if directory is not empty.
profile
Run tests and collect duration statistics.
pytest-cream profile [--ws path] [--python python3.11]
run
Execute tests with intelligent orchestration.
pytest-cream run [OPTIONS]
--threshold FLOAT Duration threshold for long/short split (default: 0.5)
--workers INT Parallel workers for short tests (default: 4)
--short-only Skip long tests
--limit INT Maximum number of tests to run
--exclude-tests STR Comma-separated patterns to exclude
--ws PATH Workspace directory
--python PATH Python executable
filter
Analyze and filter tests by duration.
pytest-cream filter --ws path --threshold 0.5
fetch
Fetch tests from repository (without installing dependencies).
pytest-cream fetch --repo owner/project --ws path
Configuration
- Config file:
.pytest-cream.json(created in current directory) - Workspace: Current directory by default
- Python: Auto-detected from workspace
.venvor system Python - Package manager: Uses
uvby default, falls back topip
Examples
# Development workflow - quick feedback
pytest-cream init --repo psf/requests
pytest-cream profile
pytest-cream run --short-only --limit 30
# CI pipeline - full suite
pytest-cream run --threshold 1.0 --workers 16
# Custom installation
pytest-cream init --repo owner/project --install-cmd "pip install -e .[dev]"
# Use pip instead of uv
pytest-cream init --repo owner/project --use-pip
Requirements
- Python 3.10+
- pytest
- pytest-xdist (for parallel execution)
- uv (optional, for faster installs)
License
MIT
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_cream-0.1.6.tar.gz.
File metadata
- Download URL: pytest_cream-0.1.6.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e86e0a56c61a3206080132ca7c5d7a60939e7558bb42366f72ee62e2a19699f3
|
|
| MD5 |
05f6c70ec2021bf44a073c144a018890
|
|
| BLAKE2b-256 |
27ca1a19ccaa2f84e9e20a1c7f18f38303761daabcb93f74d3520d7e7a306c6b
|
File details
Details for the file pytest_cream-0.1.6-py3-none-any.whl.
File metadata
- Download URL: pytest_cream-0.1.6-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a77192082535ccdf95aeff262210e4d0ff0c051f4061aa4451271c98492129a0
|
|
| MD5 |
589e53070d6f15681774c0db3369552a
|
|
| BLAKE2b-256 |
ac05419886781b6ae818f9f5b9310d4978f15d48da1d88e39f5d60a0a95c2a7e
|