Skip to main content

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

  1. Collects all tests from pytest
  2. Splits tests into equal chunks
  3. Runs chunks in parallel using asyncio
  4. 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

para_pytest-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

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

Hashes for para_pytest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 68398af01330c99f398fe211446a729985dd9425d14e8644ec51ad452cb140aa
MD5 64064dadabc2c579fb9df543224178d2
BLAKE2b-256 0e4df4b62be45d49ffb48af18b8430b7ee02b2bce950e7698ccf371b0013858c

See more details on using hashes here.

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

Hashes for para_pytest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 986f8346c55f6ea18a10985363cc37efff78cb19212dd7f0d7cb5e082002132e
MD5 326a1013bf6e20b0bbdb0db28d204940
BLAKE2b-256 82405708316f429070e788d82b47edf117e86e9846c9eabb3d64f1aad2a04765

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page