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
Metadata
Release files for pytest-cream 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_cream-0.1.7.tar.gz | 26.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_cream-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.5 kB
Release files / pytest_cream-0.1.7.tar.gz
| Download URL | pytest_cream-0.1.7.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60b621bac1bc21fc311596da893cc1efb0cf1b8e660e948bee0236ef8a4f72b9
|
|
BLAKE2b-256 checksum How to use checksums |
b5e5628db9bed23588c6a487035ba8321f8d0985206f12d140215a52341a2ec8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Release files / pytest_cream-0.1.7-py3-none-any.whl
| Download URL | pytest_cream-0.1.7-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d02a717b1ba0f6397627d4ef0a906387c158f5ac1946754bed3596ad5ea5c70
|
|
BLAKE2b-256 checksum How to use checksums |
ece2379b0dafd6e9ae4f2add115c356e367ff4ce27132afe06df9b6d30931a10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|