The cream of test execution - smooth pytest workflows with intelligent orchestration
Project description
pytest-cream
The cream of test execution - smooth pytest workflows with intelligent orchestration.
pytest-cream is a Python package designed to streamline the process of fetching tests from repositories, running them with advanced dependency management, and gathering statistics for parallel execution.
Features
- Fetch tests from remote repositories or local directories
- Advanced dependency management with custom installation commands
- Support for uv, poetry, pip, and other package managers
- Python version control for project compatibility
- Parallel test execution with intelligent orchestration
- Duration statistics and performance optimization
- Environment isolation for complex projects (Rust extensions, etc.)
Installation
pip install pytest-cream
Usage
Basic Usage
# Run tests with standard dependency installation
pytest-cream quick-run --repo owner/project --branch main --ws ~/workspace
# Use custom installation commands for complex projects
pytest-cream quick-run --repo owner/project --branch main \
--install-cmd "uv sync --extra cpu" \
--python 3.10 \
--ws ~/workspace
Advanced Usage
# Multiple installation commands with fallback
pytest-cream quick-run --repo owner/complex-project --branch main \
--install-cmd "uv sync --extra gpu; pip install torch" \
--install-fallback "pip install -e ." \
--python 3.11 \
--ws ~/workspace
# Exclude problematic tests
pytest-cream quick-run --repo owner/project --branch main \
--exclude-tests "test_slow.py,test_integration/" \
--ws ~/workspace
Original Quick Commands
# Fetch tests only
pytest-cream fetch --branch dev
# Run collected tests
pytest-cream run --all
# Filter by duration
pytest-cream filter --threshold 0.5
Command Line Options
Basic Options:
--repo: Repository to test (owner/repo or URL)--branch: Branch to test--ws/--workspace: Directory to use as workspace--threshold: Duration threshold in seconds for splitting long/short tests (default: 1.0)--workers: Number of parallel workers for short tests (default: 4)
Installation Options:
--install-repo: Repository to install code from before running tests--install-branch: Branch to install from--install-mode: How to install (pip,editable,wheel)--install-cmd: Custom install command (overrides--install-mode)--install-fallback: Fallback to standard installation if custom command fails
Test Execution Options:
--python: Python executable to use (e.g.,python3.10,/usr/bin/python3.11)--exclude-tests: Comma-separated patterns of test files/directories to exclude
Installation Modes
When using --install-repo, you have several options:
Standard Modes:
pip: Direct install from git+https URL (fastest)editable: Clone repository and install in editable mode (for development)wheel: Build wheel and install (most reproducible)
Custom Commands:
Use --install-cmd for complex dependency management that standard modes can't handle:
# uv with extras
--install-cmd "uv sync --extra cpu"
# Poetry with multiple extras
--install-cmd "poetry install --extras dev,test"
# pip with specific requirements file
--install-cmd "pip install -r requirements-dev.txt"
# Conda environment setup
--install-cmd "conda env update -f environment.yml"
Note: --install-cmd overrides --install-mode when provided. The command runs in the cloned repository directory.
Usage Priority:
- If
--install-cmdis provided → Use custom command - If
--install-uvis provided → Use uv instead of pip - Otherwise → Use standard
--install-mode(pip/editable/wheel)
Troubleshooting
Python Version Issues
Some projects require specific Python versions, especially those with Rust extensions or compiled components:
# Use Python 3.10 for projects with Rust extensions
pytest-cream quick-run \
--repo owner/rust-project \
--python python3.10
# Use Python 3.11 for newer projects
pytest-cream quick-run \
--repo owner/modern-project \
--python python3.11
Common Python version issues:
- Rust extensions often require Python 3.10 or specific versions
- Some packages may not be compatible with Python 3.13+
- Use
--pythonto specify the exact Python executable to use
Excluding Problematic Tests
When some tests fail due to missing dependencies or environment issues:
# Exclude specific test files
--exclude-tests "tests/test_integration.py,tests/test_slow.py"
# Exclude test directories
--exclude-tests "tests/integration,tests/gpu"
Pip Issues
If you encounter "No module named pip" errors when using virtualenv contexts, try using the --install-uv flag to use uv instead of pip:
pytest-cream quick-run --install-repo owner/repo --install-uv --install-mode editable
This requires uv to be installed on your system.
Custom Command Issues
If your --install-cmd fails:
-
Check the command works manually:
git clone https://github.com/owner/repo cd repo uv sync --extra cpu # or your command
-
Common fixes:
- For uv: Ensure
pyproject.tomlhas the required extras defined - For Poetry: Make sure
pyproject.tomlexists and has proper dependencies - For build errors: Check if system dependencies (like Rust, C compilers) are needed
- For uv: Ensure
-
Debugging: Check the workspace directory for logs and cloned repository to investigate build issues
License
MIT License
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.1.tar.gz.
File metadata
- Download URL: pytest_cream-0.1.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f10ed5e3373d115d35c99a21cc6cd524e6a1954b758eec7443ca43cbdb6bbb99
|
|
| MD5 |
f26d686dbf27ea17fa4636536a8bd4b0
|
|
| BLAKE2b-256 |
0e3f7918d98c50dbf60a967d9869fdfa1a432389a36c7bb4da4c1095e75c0d84
|
File details
Details for the file pytest_cream-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pytest_cream-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
644f27c3286ba7c5bfb539acbf3bc1b4d108fe660913146b92f0a1b6de3acf52
|
|
| MD5 |
6b89952d821c2f60e8b4c58c1fb4cde7
|
|
| BLAKE2b-256 |
174bef472c322ab0f20a87a85ab18687dcf4d866b02b70e4e8de64f75ae1bb49
|