Skip to content

Commit

Permalink
actions: Use pytest-rerunfailures for pytest-xdist worker crash
Browse files Browse the repository at this point in the history
Since pytest-xdist workers crash intermittently for the multiprocessing
spawn start method, use pytest-rerunfailures to detect and handle this
case. Only use pytest-rerunfailures for the spawn start-method since
that is the only case where we've observed intermittent pytest-xdist
worker crashes, and use --only-rerun 'worker .* crashed while running'
to ensure that rerun only triggers for worker crashes.

Bug: https://bugs.gentoo.org/924416
See: pytest-dev/execnet#96
Signed-off-by: Zac Medico <[email protected]>
  • Loading branch information
zmedico committed Feb 14, 2024
1 parent 038ad10 commit ffcb1eb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
python -m site
python -m pip install --upgrade pip
# setuptools needed for 3.12+ because of https://github.com/mesonbuild/meson/issues/7702.
python -m pip install pytest pytest-xdist setuptools
python -m pip install pytest pytest-rerunfailures pytest-xdist setuptools
# symlink /bin/true to /usr/bin/getuto (or do we want to grab the script from github?)
sudo ln -s /bin/true /usr/bin/getuto
Expand Down Expand Up @@ -90,8 +90,7 @@ jobs:
- name: Run tests for ${{ matrix.python-version }}
run: |
[[ "${{ matrix.start-method }}" == "spawn" ]] && export PORTAGE_MULTIPROCESSING_START_METHOD=spawn
# spawn start-method crashes pytest-xdist workers (bug 924416)
[[ "${{ matrix.start-method }}" == "spawn" ]] && \
export PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count" || \
export PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count -n $(nproc) --dist=worksteal"
export PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count -n $(nproc) --dist=worksteal"
# Use pytest-rerunfailures to workaround pytest-xdist worker crashes with spawn start-method (bug 924416).
[[ "${{ matrix.start-method }}" == "spawn" ]] && PYTEST_ADDOPTS+=" --reruns 5 --only-rerun 'worker .* crashed while running'"
meson test -C /tmp/build --verbose

0 comments on commit ffcb1eb

Please sign in to comment.