commit:     ffcb1eb3ded0dbd244836ab3020fdc5244407298
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 14 03:37:08 2024 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Feb 14 19:07:57 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ffcb1eb3

actions: Use pytest-rerunfailures for pytest-xdist worker crash

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: https://github.com/pytest-dev/execnet/issues/96
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 .github/workflows/ci.yml | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 762999b7cc..e4168203d4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
@@ -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

Reply via email to