Skip to content

feat(tests): add pytest-codeblocks for documentation code snippet CI #527

feat(tests): add pytest-codeblocks for documentation code snippet CI

feat(tests): add pytest-codeblocks for documentation code snippet CI #527

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: ci
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
jobs:
test:
if: github.event.pull_request.draft == false
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Lint with Ruff
run: |
uv run ruff format
uv run ruff check
continue-on-error: true
- name: Run tests
run: uv run pytest
- name: Test documentation code snippets
if: matrix.python-version == '3.12'
run: |
uv run pytest --codeblocks \
docs/quickstart.md \
docs/cookbook/ \
docs/tutorials/
continue-on-error: true # Don't block CI while snippets are being updated