From 542da6cb7474879bdf973219dab6e5d2bda2067d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Wed, 1 Nov 2023 19:14:22 +0100 Subject: [PATCH] Use pytest-rerunfailures to rerun flaky tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- .github/workflows/tests.yml | 10 +++++----- setup.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 43363e94..191a5854 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,9 +10,6 @@ on: workflow_dispatch: workflow: '*' -env: - MPLBACKEND: agg - jobs: code: name: code style @@ -53,6 +50,9 @@ jobs: name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }} runs-on: ${{ matrix.os }} timeout-minutes: 15 + env: + MPLBACKEND: agg + PYTEST_ARGS: --pyargs kikuchipy --reruns 2 -n 2 --cov=kikuchipy strategy: fail-fast: false matrix: @@ -120,12 +120,12 @@ jobs: run: | sudo apt-get update sudo apt-get install xvfb - xvfb-run pytest -n 2 --cov=kikuchipy --pyargs kikuchipy + xvfb-run pytest ${{ env.PYTEST_ARGS }} - name: Run tests on Windows or macOS if: ${{ matrix.os != 'ubuntu-latest' }} run: | - pytest -n 2 --cov=kikuchipy --pyargs kikuchipy + pytest ${{ env.PYTEST_ARGS }} - name: Generate line coverage run: | diff --git a/setup.py b/setup.py index 29e25c8f..8068f335 100644 --- a/setup.py +++ b/setup.py @@ -63,6 +63,7 @@ "pytest >= 5.4", "pytest-benchmark", "pytest-cov >= 2.8.1", + "pytest-rerunfailures", "pytest-xdist", ], "all": [