mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-17 19:19:12 +02:00
When GitHub's API rate limits cause asyncio shutdown issues, the test times out rather than failing with the underlying 429 error. Updated the detection logic to check for 429 indicators in the captured output when a timeout occurs. Also increased the per-test timeout from 15s to 30s to give remote API calls more breathing room. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
107 lines
3.3 KiB
YAML
107 lines
3.3 KiB
YAML
name: Tests
|
|
|
|
env:
|
|
# enable colored output
|
|
PY_COLORS: 1
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- "src/**"
|
|
- "tests/**"
|
|
- "uv.lock"
|
|
- "pyproject.toml"
|
|
- ".github/workflows/**"
|
|
|
|
# run on all pull requests because these checks are required and will block merges otherwise
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
run_tests:
|
|
name: "Run tests: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
python-version: ["3.10"]
|
|
fail-fast: false
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: "uv.lock"
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install FastMCP
|
|
# run with upgrade to always test against the latest compatible versions
|
|
run: uv sync --upgrade
|
|
|
|
- name: Run tests (excluding integration and client_process)
|
|
run: uv run pytest --inline-snapshot=disable tests -m "not integration and not client_process" --numprocesses auto --maxprocesses 4 --dist worksteal
|
|
shell: bash
|
|
|
|
- name: Run client process tests separately
|
|
run: uv run pytest --inline-snapshot=disable tests -m "client_process" -x
|
|
|
|
run_tests_lowest_direct:
|
|
name: "Run tests with lowest-direct dependencies"
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: "uv.lock"
|
|
python-version: "3.10"
|
|
|
|
- name: Install FastMCP with lowest-direct resolution
|
|
# run with lowest-direct to test against the minimum allowed dependency versions
|
|
run: uv sync --resolution lowest-direct
|
|
|
|
- name: Run tests (excluding integration and client_process)
|
|
run: uv run --resolution lowest-direct pytest --inline-snapshot=disable tests -m "not integration and not client_process" --numprocesses auto --maxprocesses 4 --dist worksteal
|
|
|
|
- name: Run client process tests separately
|
|
run: uv run --resolution lowest-direct pytest --inline-snapshot=disable tests -m "client_process" -x
|
|
|
|
run_integration_tests:
|
|
name: "Run integration tests"
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: "uv.lock"
|
|
python-version: "3.10"
|
|
|
|
- name: Install FastMCP
|
|
# run with upgrade to always test against the latest compatible versions
|
|
run: uv sync --upgrade
|
|
|
|
- name: Run integration tests
|
|
# use longer per-test timeout for remote API calls (default is 5s)
|
|
run: uv run pytest tests -m "integration" --timeout=30 --numprocesses auto --maxprocesses 2 --dist worksteal
|
|
env:
|
|
FASTMCP_GITHUB_TOKEN: ${{ secrets.FASTMCP_GITHUB_TOKEN }}
|
|
FASTMCP_TEST_AUTH_GITHUB_CLIENT_ID: ${{ secrets.FASTMCP_TEST_AUTH_GITHUB_CLIENT_ID }}
|
|
FASTMCP_TEST_AUTH_GITHUB_CLIENT_SECRET: ${{ secrets.FASTMCP_TEST_AUTH_GITHUB_CLIENT_SECRET }}
|