Skip to content

Run Live Provider Tests

Prompty’s unit tests mock provider SDKs. Live integration tests use real endpoints to catch wire-format and authentication issues that mocks can miss, such as unsupported empty stop arrays, deployment/model differences, and SDK response-shape differences.

Create a local .env file for the runtime you are testing.

VariableUsed byNotes
OPENAI_API_KEYOpenAI-compatible proxy testsOptional OPENAI_BASE_URL may point at a proxy endpoint.
DIRECT_OPENAI_API_KEYDirect OpenAI testsUses https://api.openai.com/v1.
ANTHROPIC_API_KEYAnthropic testsUsed by Anthropic provider tests.
AZURE_OPENAI_ENDPOINTFoundry/Azure OpenAI testsAzure OpenAI endpoint or compatible Foundry endpoint.
AZURE_OPENAI_API_KEYFoundry/Azure OpenAI testsAPI key auth.
AZURE_OPENAI_CHAT_DEPLOYMENTChat/agent testsDeployment id, not base model name.
AZURE_OPENAI_EMBEDDING_DEPLOYMENTEmbedding testsDeployment id for embedding model.

Entra ID tests also require a local Azure identity that can access the target resource. If the token tenant does not match the resource tenant, tests should skip rather than report a runtime failure.

Terminal window
cd runtime/python/prompty
uv run pytest tests/integration/ -v -o "addopts="

Integration tests are excluded from the normal unit-test run and skip automatically when required environment variables are missing.

  • Chat completions and provider-specific wire options
  • Streaming wrappers and trace accumulation
  • Structured output and response-format mapping
  • Embeddings and image generation where supported
  • Tool-calling agent loops
  • Provider model listing/discovery
  • API-key auth and, where configured, Entra ID auth

A skip usually means the local machine is missing a provider key, deployment name, or tenant-compatible identity. A failure means the runtime likely sent an invalid request, parsed a response incorrectly, or used an endpoint with incompatible options.

Run the smallest provider-specific test first when debugging, then rerun the full integration suite once fixed.