From 6c3e70a9fdba01a6305e52ec89839234b727046a Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Fri, 15 Sep 2023 12:17:18 -0700 Subject: [PATCH] [DEV] pytest retry for flakey tests (#718) --- .github/workflows/ci-windows.yaml | 10 +++++----- .github/workflows/ci.yaml | 10 +++++----- setup.cfg | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml index ebc8ebcb..5d0b23a9 100644 --- a/.github/workflows/ci-windows.yaml +++ b/.github/workflows/ci-windows.yaml @@ -29,7 +29,7 @@ jobs: move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe" python -m pip install -e .[test] - python -m pytest tests/unit + python -m pytest --reruns 3 --reruns-delay 5 tests/unit test-soundcloud: runs-on: windows-latest @@ -52,7 +52,7 @@ jobs: move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe" python -m pip install -e .[test] - python -m pytest tests/e2e/soundcloud + python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/soundcloud test-bandcamp: runs-on: windows-latest @@ -75,7 +75,7 @@ jobs: move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe" python -m pip install -e .[test] - python -m pytest tests/e2e/bandcamp + python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/bandcamp test-youtube: @@ -99,7 +99,7 @@ jobs: move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe" python -m pip install -e .[test] - python -m pytest tests/e2e/youtube + python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/youtube test-plugins: runs-on: windows-latest @@ -122,4 +122,4 @@ jobs: move "ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe" "ffprobe.exe" python -m pip install -e .[test] - python -m pytest tests/e2e/plugins + python -m pytest --reruns 3 --reruns-delay 5 tests/e2e/plugins diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bea651dc..b2452fdf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,7 +44,7 @@ jobs: pip install -e .[test] sudo apt-get update sudo apt-get install -y ffmpeg - coverage run -m pytest tests/unit && coverage xml -o /opt/coverage/unit/coverage.xml + coverage run -m pytest --reruns 3 --reruns-delay 5 tests/unit && coverage xml -o /opt/coverage/unit/coverage.xml - name: Save coverage uses: actions/cache@v3 @@ -70,7 +70,7 @@ jobs: pip install -e .[test] sudo apt-get update sudo apt-get install -y ffmpeg - coverage run -m pytest tests/e2e/soundcloud && coverage xml -o /opt/coverage/soundcloud/coverage.xml + coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/soundcloud && coverage xml -o /opt/coverage/soundcloud/coverage.xml test-bandcamp: runs-on: ubuntu-22.04 @@ -90,7 +90,7 @@ jobs: pip install -e .[test] sudo apt-get update sudo apt-get install -y ffmpeg - coverage run -m pytest tests/e2e/bandcamp && coverage xml -o /opt/coverage/bandcamp/coverage.xml + coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/bandcamp && coverage xml -o /opt/coverage/bandcamp/coverage.xml - name: Save coverage uses: actions/cache@v3 @@ -116,7 +116,7 @@ jobs: pip install -e .[test] sudo apt-get update sudo apt-get install -y ffmpeg - coverage run -m pytest tests/e2e/youtube && coverage xml -o /opt/coverage/youtube/coverage.xml + coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/youtube && coverage xml -o /opt/coverage/youtube/coverage.xml - name: Save coverage uses: actions/cache@v3 @@ -142,7 +142,7 @@ jobs: pip install -e .[test] sudo apt-get update sudo apt-get install -y ffmpeg - coverage run -m pytest tests/e2e/plugins && coverage xml -o /opt/coverage/plugins/coverage.xml + coverage run -m pytest --reruns 3 --reruns-delay 5 tests/e2e/plugins && coverage xml -o /opt/coverage/plugins/coverage.xml - name: Save coverage uses: actions/cache@v3 diff --git a/setup.cfg b/setup.cfg index 7bc55744..2e51e53a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,7 @@ where=src test = coverage[toml]==6.3.2 pytest==7.1.1 + pytest-rerunfailures==12.0 lint = black==22.3.0 isort==5.10.1