From b3144add4304364eae1aa586a8c86160d26c1377 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Sun, 8 Nov 2026 19:01:33 +0100 Subject: [PATCH 1/2] Rerun only the failed tests on CI retries The `nick-fields/retry` steps reran the whole suite on every attempt, so a real failure cost a second full run (up to ~26 min) before the job went red, and a test killed by `pytest-timeout` reran all tensor tests. Each pytest command inside a retry step now passes `--lf`. The first attempt has no recorded failures and runs everything; a retry runs only the tests that failed. An attempt killed by the step timeout records nothing, so the next one runs all tests again. Coverage keeps full reruns, since a partial rerun would drop coverage data. --- .github/workflows/check-onemath.yaml | 9 +++++---- .github/workflows/conda-build-test.yml | 7 ++++--- .github/workflows/conda-package.yml | 13 +++++++------ .github/workflows/cron-run-tests.yaml | 5 +++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check-onemath.yaml b/.github/workflows/check-onemath.yaml index 544367ae819..53f796bbbd4 100644 --- a/.github/workflows/check-onemath.yaml +++ b/.github/workflows/check-onemath.yaml @@ -27,6 +27,7 @@ env: test-pkg-env: 'environments/test.yml' test-env-name: 'test_onemath' rerun-tests-on-failure: 'true' + # A retry reruns only the failed tests (--lf), or all of them after a timeout kill rerun-tests-max-attempts: 2 rerun-tests-timeout: 30 rerun-tensor-tests-timeout: 10 @@ -188,7 +189,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --pyargs dpnp.tests + python -m pytest -ra --lf --pyargs dpnp.tests env: SKIP_TENSOR_TESTS: 1 SYCL_CACHE_PERSISTENT: 1 @@ -206,7 +207,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --pyargs dpnp.tests.tensor + python -m pytest -ra --lf --pyargs dpnp.tests.tensor env: SYCL_CACHE_PERSISTENT: 1 @@ -324,7 +325,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --pyargs dpnp.tests + python -m pytest -ra --lf --pyargs dpnp.tests env: SKIP_TENSOR_TESTS: 1 SYCL_CACHE_PERSISTENT: 1 @@ -342,6 +343,6 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --pyargs dpnp.tests.tensor + python -m pytest -ra --lf --pyargs dpnp.tests.tensor env: SYCL_CACHE_PERSISTENT: 1 diff --git a/.github/workflows/conda-build-test.yml b/.github/workflows/conda-build-test.yml index 77a934a1598..0f6f5701365 100644 --- a/.github/workflows/conda-build-test.yml +++ b/.github/workflows/conda-build-test.yml @@ -33,6 +33,7 @@ env: fetch-depth: 1 python-ver-test-all-dtypes: '3.14' test-env-name: 'test' + # A retry reruns only the failed tests (--lf), or all of them after a timeout kill rerun-tests-max-attempts: 2 rerun-tests-timeout: 45 rerun-tensor-tests-timeout: 15 @@ -282,9 +283,9 @@ jobs: if [[ "${{ env.python-label }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then export DPNP_TEST_ALL_INT_TYPES=1 - python -m pytest -ra --pyargs ${{ env.module-name }}.tests + python -m pytest -ra --lf --pyargs ${{ env.module-name }}.tests else - python -m pytest -n auto -ra --pyargs ${{ env.module-name }}.tests + python -m pytest -n auto -ra --lf --pyargs ${{ env.module-name }}.tests fi - name: Run tensor tests @@ -300,4 +301,4 @@ jobs: . "$CONDA_UNIX/etc/profile.d/conda.sh" conda activate ${{ env.test-env-name }} - python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor + python -m pytest -n auto -ra --lf --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 4fc22b5b467..a1a1a70e37b 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -27,6 +27,7 @@ env: python-ver-test-all-dtypes: '3.14' test-env-name: 'test' rerun-tests-on-failure: 'true' + # A retry reruns only the failed tests (--lf), or all of them after a timeout kill rerun-tests-max-attempts: 2 rerun-tests-timeout: 45 rerun-tensor-tests-timeout: 15 @@ -295,9 +296,9 @@ jobs: if [[ "${{ env.python-label }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then export DPNP_TEST_ALL_INT_TYPES=1 - python -m pytest -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests else - python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -n auto -ra --lf --pyargs ${{ env.package-name }}.tests fi - name: Run tensor tests @@ -318,7 +319,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor + python -m pytest -n auto -ra --lf --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor test_examples_linux: name: Test examples @@ -603,9 +604,9 @@ jobs: $env:SKIP_TENSOR_TESTS=1 if ( "${{ env.python-label }}" -eq "${{ env.python-ver-test-all-dtypes }}" ) { $env:DPNP_TEST_ALL_INT_TYPES=1 - python -m pytest -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests } else { - python -m pytest -n auto -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -n auto -ra --lf --pyargs ${{ env.package-name }}.tests } - name: Run tensor tests @@ -624,7 +625,7 @@ jobs: retry_on: any shell: pwsh command: | - python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor + python -m pytest -n auto -ra --lf --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor upload: name: Upload diff --git a/.github/workflows/cron-run-tests.yaml b/.github/workflows/cron-run-tests.yaml index b832ebbec61..bedb688c1df 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -16,6 +16,7 @@ env: channels-list: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels' test-env-name: test test-packages: 'pytest scipy' + # A retry reruns only the failed tests (--lf), or all of them after a timeout kill rerun-tests-max-attempts: 2 rerun-tests-timeout: 20 @@ -155,7 +156,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests env: SYCL_CACHE_PERSISTENT: 1 @@ -168,6 +169,6 @@ jobs: max_attempts: ${{ env.rerun-tests-max-attempts }} retry_on: any command: | - python -m pytest -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests env: SYCL_CACHE_PERSISTENT: 1 From 103bcde09b9305599118d10b6bb623a9bc45e6eb Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Sun, 8 Nov 2026 20:59:41 +0100 Subject: [PATCH 2/2] Continue past collection errors in serial runs a --lf retry follows A collection error interrupts a serial pytest run before any test runs and records only the broken module, so a `--lf` retry ran just that module and could pass without the rest of the suite. With `--continue-on-collection-errors` the first attempt runs the other tests, and the retry covers their failures too. The `-n auto` runs don't need it, since xdist already runs the remaining tests after a collection error. --- .github/workflows/check-onemath.yaml | 9 +++++---- .github/workflows/conda-build-test.yml | 3 ++- .github/workflows/conda-package.yml | 5 +++-- .github/workflows/cron-run-tests.yaml | 7 ++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-onemath.yaml b/.github/workflows/check-onemath.yaml index 53f796bbbd4..07bc46f6a18 100644 --- a/.github/workflows/check-onemath.yaml +++ b/.github/workflows/check-onemath.yaml @@ -28,6 +28,7 @@ env: test-env-name: 'test_onemath' rerun-tests-on-failure: 'true' # A retry reruns only the failed tests (--lf), or all of them after a timeout kill + # Serial runs also need --continue-on-collection-errors, or a collection error skips all other tests rerun-tests-max-attempts: 2 rerun-tests-timeout: 30 rerun-tensor-tests-timeout: 10 @@ -189,7 +190,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --lf --pyargs dpnp.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs dpnp.tests env: SKIP_TENSOR_TESTS: 1 SYCL_CACHE_PERSISTENT: 1 @@ -207,7 +208,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --lf --pyargs dpnp.tests.tensor + python -m pytest -ra --lf --continue-on-collection-errors --pyargs dpnp.tests.tensor env: SYCL_CACHE_PERSISTENT: 1 @@ -325,7 +326,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --lf --pyargs dpnp.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs dpnp.tests env: SKIP_TENSOR_TESTS: 1 SYCL_CACHE_PERSISTENT: 1 @@ -343,6 +344,6 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --lf --pyargs dpnp.tests.tensor + python -m pytest -ra --lf --continue-on-collection-errors --pyargs dpnp.tests.tensor env: SYCL_CACHE_PERSISTENT: 1 diff --git a/.github/workflows/conda-build-test.yml b/.github/workflows/conda-build-test.yml index 0f6f5701365..93a2029da29 100644 --- a/.github/workflows/conda-build-test.yml +++ b/.github/workflows/conda-build-test.yml @@ -34,6 +34,7 @@ env: python-ver-test-all-dtypes: '3.14' test-env-name: 'test' # A retry reruns only the failed tests (--lf), or all of them after a timeout kill + # Serial runs also need --continue-on-collection-errors, or a collection error skips all other tests rerun-tests-max-attempts: 2 rerun-tests-timeout: 45 rerun-tensor-tests-timeout: 15 @@ -283,7 +284,7 @@ jobs: if [[ "${{ env.python-label }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then export DPNP_TEST_ALL_INT_TYPES=1 - python -m pytest -ra --lf --pyargs ${{ env.module-name }}.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs ${{ env.module-name }}.tests else python -m pytest -n auto -ra --lf --pyargs ${{ env.module-name }}.tests fi diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index a1a1a70e37b..ebdf5c066cc 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -28,6 +28,7 @@ env: test-env-name: 'test' rerun-tests-on-failure: 'true' # A retry reruns only the failed tests (--lf), or all of them after a timeout kill + # Serial runs also need --continue-on-collection-errors, or a collection error skips all other tests rerun-tests-max-attempts: 2 rerun-tests-timeout: 45 rerun-tensor-tests-timeout: 15 @@ -296,7 +297,7 @@ jobs: if [[ "${{ env.python-label }}" == "${{ env.python-ver-test-all-dtypes }}" ]]; then export DPNP_TEST_ALL_INT_TYPES=1 - python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs ${{ env.package-name }}.tests else python -m pytest -n auto -ra --lf --pyargs ${{ env.package-name }}.tests fi @@ -604,7 +605,7 @@ jobs: $env:SKIP_TENSOR_TESTS=1 if ( "${{ env.python-label }}" -eq "${{ env.python-ver-test-all-dtypes }}" ) { $env:DPNP_TEST_ALL_INT_TYPES=1 - python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs ${{ env.package-name }}.tests } else { python -m pytest -n auto -ra --lf --pyargs ${{ env.package-name }}.tests } diff --git a/.github/workflows/cron-run-tests.yaml b/.github/workflows/cron-run-tests.yaml index bedb688c1df..b3593bfb176 100644 --- a/.github/workflows/cron-run-tests.yaml +++ b/.github/workflows/cron-run-tests.yaml @@ -17,6 +17,7 @@ env: test-env-name: test test-packages: 'pytest scipy' # A retry reruns only the failed tests (--lf), or all of them after a timeout kill + # Serial runs also need --continue-on-collection-errors, or a collection error skips all other tests rerun-tests-max-attempts: 2 rerun-tests-timeout: 20 @@ -139,7 +140,7 @@ jobs: id: run_tests continue-on-error: true run: | - python -m pytest -ra --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --continue-on-collection-errors --pyargs ${{ env.package-name }}.tests env: SYCL_CACHE_PERSISTENT: 1 @@ -156,7 +157,7 @@ jobs: . $CONDA/etc/profile.d/mamba.sh mamba activate ${{ env.test-env-name }} - python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs ${{ env.package-name }}.tests env: SYCL_CACHE_PERSISTENT: 1 @@ -169,6 +170,6 @@ jobs: max_attempts: ${{ env.rerun-tests-max-attempts }} retry_on: any command: | - python -m pytest -ra --lf --pyargs ${{ env.package-name }}.tests + python -m pytest -ra --lf --continue-on-collection-errors --pyargs ${{ env.package-name }}.tests env: SYCL_CACHE_PERSISTENT: 1