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.0.tar.gz
(9.6 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.0.tar.gz.
File metadata
- Download URL: para_pytest-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fdc54729db62e05b970ab52536f599d6666630b2ff599e8d19bd14e75dc5b1f
|
|
| MD5 |
94d8c6f1f5272c3c7c55113d28b19357
|
|
| BLAKE2b-256 |
1a861dbbe665addee0286d568be56b7d01871f2578aa8a8edb565cfda511b01e
|
File details
Details for the file para_pytest-0.1.0-py3-none-any.whl.
File metadata
- Download URL: para_pytest-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 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 |
05be27e574a888dc22d465b3f46ca55575485000a66389631a174b6d9457e903
|
|
| MD5 |
b00baaca3746b86d452d04a8cec82f6a
|
|
| BLAKE2b-256 |
5e2b09cb49c6630fe35d5d0618fe347b0b240f0a3b57c1e1cc01f646d54600b7
|