Skip to content

Add required result_id argument in task queue loop. #9574

Add required result_id argument in task queue loop.

Add required result_id argument in task queue loop. #9574

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
permissions: {}
jobs:
check-lock-file:
# validate uv.lock against requirements
# a failure indicates that the lock file is out of sync
# with requirements and needs to be updated
# this is normally done using uv-pre-commit but yt's dependency
# graph is too big to run on pre-commit.ci
name: Check uv.lock
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: ">=0.9.11,<0.10.0" # pin uv to avoid the lock file format going out-of-sync
python-version: 3.14
cache-suffix: lockcheck
prune-cache: false
- run: uv lock --check
build:
name: "${{ matrix.tests-type }} tests: py${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.test-runner }})"
needs: [check-lock-file]
strategy:
# run all tests even if e.g. image tests fail early
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
python-version: ['3.13']
sync_args: [--extra=full]
tests-type: [unit]
test-runner: [pytest]
cache-suffix: [null]
include:
- os: windows-latest
python-version: '3.13'
sync_args: --extra=full
tests-type: unit
test-runner: pytest
cache-suffix: alldeps
- os: ubuntu-22.04
python-version: '3.10.4'
sync_args: --resolution=lowest
tests-type: unit
test-runner: pytest
cache-suffix: oldestdeps
- os: ubuntu-latest
# this job is necessary for non-answer, 'yield' based tests
# because pytest doesn't support such tests
python-version: '3.10'
sync_args: "--extra=full --group=nosetest"
tests-type: unit
test-runner: nose
cache-suffix: alldeps-nose
- os: ubuntu-latest
# answer tests use 'yield', so they require nose
# they are also attached to a specific, occasionally updated, Python version
# but it does *not* have to match the current minimal supported version
python-version: '3.10'
sync_args: "--extra=full --group=nosetest"
tests-type: answer
test-runner: nose
cache-suffix: alldeps-nose
- os: ubuntu-latest
# minimal tests with latest Python and no optional dependencies
python-version: '3.14'
sync_args: null
tests-type: unit
test-runner: pytest
cache-suffix: minimal
runs-on: ${{ matrix.os }}
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.tests-type }}-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.test-runner }}
cancel-in-progress: true
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
submodules: ${{ matrix.tests-type == 'answer' }}
- name: Set up Python
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python-version }}
cache-suffix: ${{ matrix.cache-suffix }}
prune-cache: false
- name: Install dependencies and yt
shell: bash
env:
sync_args: ${{ matrix.sync_args}}
run: source ./tests/ci_install.sh
- name: Patch nosetest
if: matrix.test-runner == 'nose'
# note: this could be handled with [tool.uv.sources]
run: |
find .venv/lib/python${{matrix.python-version}}/site-packages/nose -name '*.py' \
-exec sed -i -e s/collections.Callable/collections.abc.Callable/g '{}' ';'
- name: Run Unit Tests (pytest)
if: matrix.test-runner == 'pytest'
run: uv run --no-sync pytest yt --color=yes ${{ contains(matrix.sync_args , 'resolution=lowest' ) && '-Wdefault' || '' }}
env:
MPLCONFIGDIR: tests
- name: Run Tests (nose)
if: matrix.test-runner == 'nose'
run: |
cat nose_ignores | xargs uv run python -m nose -c nose_unit.cfg --traverse-namespace
env:
MPLCONFIGDIR: tests
image-tests:
name: Image tests
runs-on: ubuntu-latest
needs: [check-lock-file]
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repo (with submodules)
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
persist-credentials: false
- name: Set up Python
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: '3.11'
enable-cache: false
- name: Install dependencies and yt
shell: bash
env:
sync_args: --group=mapping
run: source ./tests/ci_install.sh
- run: python -m pip list
- name: Run Image Tests
run: |
uv run --no-sync \
pytest yt --color=yes --mpl -m mpl_image_compare \
--mpl-generate-summary=html \
--mpl-results-path=pytest_mpl_results \
--mpl-baseline-path=tests/pytest_mpl_baseline \
-rxXs # show extra info on xfailed, xpassed, and skipped tests
env:
MPLCONFIGDIR: tests
- name: Generate new image baseline
if: failure()
run: |
uv run --no-sync \
pytest yt --color=yes --mpl -m mpl_image_compare \
--mpl-generate-path=pytest_mpl_new_baseline \
--last-failed
env:
MPLCONFIGDIR: tests
# always attempt to upload artifacts, even
# (and especially) in case of failure.
- name: Upload pytest-mpl report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: yt_pytest_mpl_results
path: pytest_mpl_results/*
- name: Upload pytest-mpl baseline
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: yt_pytest_mpl_new_baseline
path: pytest_mpl_new_baseline/*
if-no-files-found: ignore