Run pytest tests in parallel chunks for faster test execution
Project description
Parallel Pytest (para-pytest)
Run pytest tests in parallel chunks for significantly faster test execution.
Installation
pip install para-pytest
Quick Start
# Run with default settings (4 chunks)
para-pytest
# Specify number of chunks
para-pytest --chunks 8
# Specify test path
para-pytest --path tests/
Use Cases
Local Development
Speed up your test suite during development:
# Before (sequential execution)
pytest tests/
# After (parallel execution)
para-pytest --chunks 4
Continuous Integration
Add to your GitHub Actions workflow:
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12.3'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install para-pytest
- name: Run tests
run: para-pytest --chunks 4 --path tests/
Or use the Github Action:
- uses: ALHelton/parallel-pytest@v1
with:
chunks: 8
path: tests/
Python API
from para_pytest import ParaPytestRunner
runner = ParaPytestRunner(chunks=4, pytest_args=['tests/'])
exit_code = runner.run()
How It Works
- Collects all tests from pytest
- Splits tests into equal chunks
- Runs chunks in parallel using asyncio
- Aggregates and displays results
Requirements
- Python 3.9+
- pytest 7.0+
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
para_pytest-0.1.1.tar.gz
(7.9 kB
view details)
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 para_pytest-0.1.1.tar.gz.
File metadata
- Download URL: para_pytest-0.1.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68398af01330c99f398fe211446a729985dd9425d14e8644ec51ad452cb140aa
|
|
| MD5 |
64064dadabc2c579fb9df543224178d2
|
|
| BLAKE2b-256 |
0e4df4b62be45d49ffb48af18b8430b7ee02b2bce950e7698ccf371b0013858c
|
File details
Details for the file para_pytest-0.1.1-py3-none-any.whl.
File metadata
- Download URL: para_pytest-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
986f8346c55f6ea18a10985363cc37efff78cb19212dd7f0d7cb5e082002132e
|
|
| MD5 |
326a1013bf6e20b0bbdb0db28d204940
|
|
| BLAKE2b-256 |
82405708316f429070e788d82b47edf117e86e9846c9eabb3d64f1aad2a04765
|