mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
| .. | ||
| __init__.py | ||
| check_coverage_sync.py | ||
| collector.py | ||
| README.md | ||
| schema.py | ||
| test_collector.py | ||
e2e coverage metadata
E2E coverage is declared directly on pytest tests. There are no coverage YAML files.
Each collected pytest under tests/e2e must have:
pytestmark = [
pytest.mark.e2e,
pytest.mark.e2e_coverage(
module="core_llms",
endpoint="/chat/completions",
provider="openai",
params=["tools", "streaming"],
),
]
Use a module-level pytestmark when every test in a file covers the same
surface. Use a per-test marker when a file mixes endpoints, providers, or params.
Required fields
module: one of the known dashboard modules inschema.pyendpoint: a known endpoint or surface, such as/chat/completions,/v1/messages,/v1/batches,/budget/*, or/spend/*provider: a known provider/integration, such asproxy,openai,anthropic,vertex_ai,prometheus, ormultipleparams: one or more explicit lowercase parameter/behavior names
How coverage is measured
The collector runs pytest in collect-only mode, validates e2e_coverage markers,
and expands each marker into unique:
module x endpoint x provider x param
coverage units.
The report shows:
- unique coverage units by module
- collected pytest test count by module
- endpoint/provider/param breakdowns for Grafana tables
- missing or invalid metadata counts for CI
This answers questions like:
How many /chat/completions rate-limit params do we exercise?
How many budget tests exist?
Which modules gained or lost endpoint coverage over time?
Commands
Render the report:
cd tests/e2e
PYTHONPATH=. python -m coverage_registry.collector
Emit Loki lines after the e2e job:
cd tests/e2e
PYTHONPATH=. python -m coverage_registry.collector --format loki --strict
Validate every collected pytest has metadata:
cd tests/e2e
PYTHONPATH=. python -m coverage_registry.check_coverage_sync
CI runs the sync check in .github/workflows/test-code-quality.yml.
Adding coverage
- Add the pytest.
- Add
@pytest.mark.e2e_coverage(...)or module-levelpytestmark. - Pick the closest module, endpoint, provider, and params.
- If the endpoint or provider is real but rejected, add it to
schema.py. - Run
PYTHONPATH=. python -m coverage_registry.check_coverage_syncfromtests/e2e.