mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-25 05:54:53 +00:00
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
4.9 KiB
4.9 KiB
Expected Structure
tests/rust-python-harness/
├── __main__.py
├── cli/
│ ├── __init__.py
│ ├── catalog.py
│ └── commands.py
│
├── strategies/
│ ├── drift/
│ │ ├── __init__.py
│ │ ├── AGENTS.md
│ │ ├── command.py
│ │ ├── drift.json
│ │ └── runner.py
│ │
│ ├── e2e_parity/
│ │ ├── __init__.py
│ │ ├── reporting.py
│ │ ├── sdk/
│ │ │ └── ocr/
│ │
│ ├── trace_parity/
│ │ ├── __init__.py
│ │ ├── models.py
│ │ ├── reporting.py
│ │ └── sdk/
│ │ ├── chat_completions/
│ │ ├── messages/
│ │ ├── ocr/
│ │ └── transcription/
│ │
│ ├── unit_tests_parity/
│ │ ├── __init__.py
│ │ ├── reporting.py
│ │ └── runner.py
│ │
│ └── unit_tests_rust/
│ ├── __init__.py
│ ├── reporting.py
│ └── runner.py
│
└── shared/
├── parity/
├── tracing/
├── reporting/
│ └── strategy.py
└── unit_runners/
├── contracts.py
└── suite_runner.py
- Every strategy is a folder under
strategies/with anAGENTS.mdand an__init__.pyexporting exactly oneSTRATEGY. Its id must equal the folder name. SDK strategies exportStrategyDefinition; the repository-source drift strategy exportsRepositoryStrategyDefinition shared/reporting/strategy.pyis the contract: runnable module/suite specs, not-implemented/skipped specs, the runner protocol, andStrategyDefinition- Every SDK
StrategyDefinitionexplicitly classifies every SDK function. Surface-aware SDK strategies declare their surfaces and classify the complete surface-by-function matrix. Repository strategies use their own options rather than SDK--functionor--surfaceselection - Run locally only. No CI integration
uv run python -m tests.rust-python-harness run drift --target HEADinventories committed Python and Rust changes usingstrategies/drift/drift.json. Seestrategies/drift/AGENTS.mdfor usage, exploratory--sincecomparisons, and manual snapshot checkpoints with independent unknown, drifted, or aligned statespython -m tests.rust-python-harness run <strategy>runs the selected strategy with its supported options. SDK strategies share--function.run allruns SDK execution tests; invokerun driftexplicitly for the repository change inventory- Examples:
run e2e_parity --surface sdk --function ocr,run unit_tests_parity --function ocr --pytest-arg=-x, orrun all --function ocr cli/catalog.pydiscovers strategies, validates their Python definitions, and orders them.cli/__init__.pybuilds the Click command tree.cli/commands.pyruns selected casese2e_parity/compares SDK objects, exceptions, callbacks, and streams, or gateway HTTP responsestrace_parity/profiles the Python call stack and prints every collected Python call underlitellm/. It never collects Rust spans and never rebuilds the native extension- E2E and trace strategies load their registered module cases and run surface-specific execution from their folders
shared/unit_runners/contracts.pyowns the typed per-function unit contracts consumed byunit_tests_parityandunit_tests_rustunit_tests_parity/runner.pyruns each contract'sunit_parity_scopewithLITELLM_RUST=0andLITELLM_RUST=1in separate processes and requires matching outcomes, including failures. Exclusions require a reason in the contractunit_tests_rust/runner.pyruns each contract's focused Cargo test suite. Native Rust unit tests stay beside their implementationshared/unit_runners/suite_runner.pyruns typed suites registered in code with nodeids of the formsuite:<strategy_id>:<function>:<suite>- Every SDK strategy declares its report sections and presentation in its own
reporting.py. Shared reporting code only provides reusable models and cell-formatting primitives. Drift emits its repository change report directly shared/contains reusable parity, tracing, reporting primitives, and unit-runner machinery- Keep fixtures with their owning API and existing Python tests in their current locations
- Each test strategy folder carries an
AGENTS.mdone-liner stating what it should be doing. The repository-source drift strategy keeps its usage guide instrategies/drift/AGENTS.md - Run the harness's own checks with
uv run pytest -o consider_namespace_packages=true tests/rust-python-harness/shared tests/rust-python-harness/cli tests/rust-python-harness/strategies/drift tests/rust-python-harness/strategies/trace_parity tests/rust-python-harness/strategies/unit_tests_parity tests/rust-python-harness/strategies/unit_tests_rust -q