Skip to content

Commit

Permalink
Split tests with pytest-split
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Sep 10, 2024
1 parent da68b65 commit b821f80
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 }}"
Expand Down

0 comments on commit b821f80

Please sign in to comment.