Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .genignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ examples/*
src/mistralai/extra/*
pylintrc
scripts/prepare_readme.py
scripts/run_all_tests.sh
tests/test_prepare_readme.py
tests/unit/**
tests/test_integration.py
34 changes: 34 additions & 0 deletions .github/workflows/contract_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: SDK Contract Tests
permissions:
checks: write
contents: write
pull-requests: write
statuses: write

"on":
workflow_dispatch:
inputs:
target:
description: "Target to test (default: all)"
type: choice
options:
- all
- mistralai-azure-sdk
- mistralai-gcp-sdk
pull_request:
branches:
- main
paths:
- "src/**"
- "packages/**"
- ".speakeasy/**"
- "tests/**"

jobs:
test:
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-test.yaml@v15
with:
target: ${{ github.event.inputs.target || 'all' }}
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
46 changes: 44 additions & 2 deletions .github/workflows/test_custom_code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,47 @@ jobs:
- name: Run the 'src/mistralai/extra' package unit tests
run: uv run python3.12 -m unittest discover -s src/mistralai/extra/tests -t src

- name: Run pytest for repository tests
run: uv run pytest tests/
- name: Run unit tests
run: |
uv run pytest tests/unit/ -v --tb=short -x
uv run pytest packages/azure/tests/unit/ -v --tb=short -x
uv run pytest packages/gcp/tests/unit/ -v --tb=short -x

- name: Run parity tests
run: |
uv run pytest packages/azure/tests/test_azure_v2_parity.py -v
uv run pytest packages/gcp/tests/test_gcp_v2_parity.py -v

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Start Speakeasy mock server
run: |
cd tests/mockserver
go run . -address :18080 &
sleep 3
curl -sf http://localhost:18080/_mockserver/health || echo "Mock server health check failed"

- name: Run Speakeasy contract tests
run: uv run pytest tests/ --ignore=tests/unit/ -m "not integration"

- name: Run main SDK integration tests
if: ${{ secrets.MISTRAL_API_KEY != '' }}
env:
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
run: uv run pytest tests/test_integration.py -v

- name: Run Azure integration tests
if: ${{ secrets.AZURE_API_KEY != '' }}
env:
AZURE_API_KEY: ${{ secrets.AZURE_API_KEY }}
AZURE_ENDPOINT: ${{ secrets.AZURE_ENDPOINT }}
run: uv run pytest packages/azure/tests/test_azure_integration.py -v

- name: Run GCP integration tests
if: ${{ secrets.GCP_PROJECT_ID != '' }}
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
run: uv run pytest packages/gcp/tests/test_gcp_integration.py -v
2,278 changes: 1,614 additions & 664 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ generation:
requestBodyFieldName: ""
versioningStrategy: automatic
persistentEdits:
enabled: "true"
enabled: "false"
tests:
generateTests: true
generateNewTests: false
Expand All @@ -36,6 +36,7 @@ python:
dev:
pytest: ^8.2.2
pytest-asyncio: ^0.23.7
pytest-xdist: ^3.5.0
main: {}
allowedRedefinedBuiltins:
- id
Expand Down
1 change: 1 addition & 0 deletions .speakeasy/testfiles/example.file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world
Loading
Loading