From b821f80aa1adfc72043286fd0206e0f300dbbad0 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Tue, 10 Sep 2024 22:30:01 +0200 Subject: [PATCH] Split tests with pytest-split --- .github/workflows/test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b1aca077..feb1ed34c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,19 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] python-version: [ "3.8", "3.12" ] + include: + # pytest-split handles dividing the tests into n groups indexed 1...n. + # The tests are automatically split so that the expected duration of each + # group is roughly the same. + - os: ubuntu-latest + pytest-split-total-groups: 3 + pytest-split-group-index: [1, 2, 3] + - os: macos-latest + pytest-split-total-groups: 3 + pytest-split-group-index: [1, 2, 3] + - os: windows-latest + pytest-split-total-groups: 5 + pytest-split-group-index: [1, 2, 3, 4, 5] defaults: run: shell: bash -eo pipefail -l {0} @@ -65,6 +78,8 @@ jobs: --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term \ --store-durations \ --durations-path "${{ github.workspace }}/tests/durations/${{ matrix.os }}-py${{ matrix.python-version }}.json" \ + --splits="${{ matrix.pytest-split-total-groups }}" \ + --group="${{ matrix.pytest-split-group-index }}" \ tests cp coverage.xml "${{ github.workspace }}"