pytest-test-groups

1.2.1 · active · verified Fri Apr 10

pytest-test-groups is a Pytest plugin (current version 1.2.1) designed to split a test run into equally sized groups, allowing users to execute a subset of their tests. This is particularly useful in Continuous Integration (CI) environments for parallelizing test execution. The library maintains an active development status with periodic releases to support newer Python and Pytest versions.

Warnings

Install

Imports

Quickstart

Create a test file and run pytest with the `--test-group-count` and `--test-group-id` arguments to execute a specific subset of tests. Optionally, use `--test-group-random-seed` for reproducible random grouping.

# Save as test_example.py
import pytest

def test_alpha():
    assert True

def test_beta():
    assert True

def test_gamma():
    assert True

def test_delta():
    assert True

def test_epsilon():
    assert True

# To run group 1 of 2:
# pytest --test-group-count=2 --test-group-id=1

# To run group 2 of 2:
# pytest --test-group-count=2 --test-group-id=2

# To ensure consistent grouping across runs, especially with random selection:
# pytest --test-group-count=2 --test-group-id=1 --test-group-random-seed=123

view raw JSON →