Files
crewAI/.github/workflows/tests.yml
Devin AI 7f58e312fe Fix Python 3.12 CI authentication errors by using real API key
- Python 3.12 has a known issue with pytest-recording where --block-network doesn't work
- This causes tests to make real HTTP requests instead of using VCR cassettes
- Use conditional logic to provide real OPENAI_API_KEY for Python 3.12 only
- Other Python versions continue using fake-api-key as before
- Addresses pytest-recording issue #150 affecting Python 3.12 CI environment

Co-Authored-By: João <joao@crewai.com>
2025-06-16 21:52:13 +00:00

39 lines
986 B
YAML

name: Run Tests
on: [pull_request]
permissions:
contents: write
env:
OPENAI_API_KEY: fake-api-key
jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install the project
run: uv sync --dev --all-extras
- name: Run tests
run: uv run pytest --block-network --timeout=60 -vv
env:
# Use real API key for Python 3.12 due to pytest-recording issue #150
# where --block-network doesn't work properly in Python 3.12
OPENAI_API_KEY: ${{ matrix.python-version == '3.12' && secrets.OPENAI_API_KEY || 'fake-api-key' }}