Skip to content

Python: pass explicit None to optional kernel function parameters unchanged #11564

Python: pass explicit None to optional kernel function parameters unchanged

Python: pass explicit None to optional kernel function parameters unchanged #11564

name: Python Unit Tests
on:
pull_request:
branches: ["main", "feature*"]
paths:
- "python/**"
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
jobs:
python-unit-tests:
name: Python Unit Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-latest, windows-latest, macos-latest]
test-suite: ["unit-all-except-dapr", "dapr"]
exclude:
- python-version: "3.11"
os: macos-latest
env:
UV_PYTHON: ${{ matrix.python-version }}
permissions:
contents: write
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
version: "0.13.x"
enable-cache: true
cache-suffix: ${{ runner.os }}-${{ matrix.python-version }}
cache-dependency-glob: "**/uv.lock"
- name: Install the project (supported extras)
if: matrix.test-suite == 'unit-all-except-dapr'
shell: bash
run: |
uv venv
extras=$(python - <<'PY'
import sys
import tomllib
from pathlib import Path
extras = set(tomllib.loads(Path("pyproject.toml").read_text())["project"]["optional-dependencies"])
if sys.version_info >= (3, 14) or (sys.platform == "win32" and sys.version_info[:2] == (3, 13)):
extras.discard("autogen")
print(",".join(sorted(extras)))
PY
)
uv pip install --editable ".[$extras]" --group dev --upgrade --prerelease=if-necessary-or-explicit
- name: Install the project (dapr tests)
if: matrix.test-suite == 'dapr'
shell: bash
run: |
uv venv
uv pip install --editable ".[pandas]" --group dev --upgrade --prerelease=if-necessary-or-explicit "dapr>=1.14.0" "dapr-ext-fastapi>=1.14.0" "flask-dapr>=1.14.0"
- name: Test with pytest (all except dapr)
if: matrix.test-suite == 'unit-all-except-dapr'
env:
PYTHON_GIL: ${{ matrix.gil }}
run: >-
uv run --no-sync python -u -X faulthandler -m pytest --junitxml=pytest.xml ./tests/unit --ignore=tests/unit/processes/dapr_runtime
${{ (matrix.python-version == '3.14' || (matrix.python-version == '3.13' && runner.os == 'Windows')) && '--ignore=tests/unit/agents/autogen_conversable_agent' || '' }}
- name: Test dapr with pytest
if: matrix.test-suite == 'dapr'
env:
PYTHON_GIL: ${{ matrix.gil }}
run: uv run --no-sync python -u -X faulthandler -m pytest --junitxml=pytest-dapr.xml ./tests/unit/processes/dapr_runtime
- name: Surface failing tests
if: matrix.test-suite == 'unit-all-except-dapr'
uses: pmeier/pytest-results-action@fdc7f18d9934e38aca411ca9557e6577bd25ca9c # v0.9.0
with:
path: python/pytest.xml
summary: true
display-options: fEX
fail-on-empty: true
title: Test results