mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
fix(ci): verify coverage uploads and normalize dependency inventories
This commit is contained in:
parent
6aa921c1bc
commit
21beb9b7b1
3 changed files with 23 additions and 6 deletions
|
|
@ -167,8 +167,9 @@ jobs:
|
|||
with:
|
||||
name: mcp-dependency-coverage
|
||||
path: coverage-reports
|
||||
- uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
|
||||
- uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
|
||||
with:
|
||||
version: v11.3.1
|
||||
use_oidc: true
|
||||
directory: coverage-reports
|
||||
flags: mcp-dependencies
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from collections.abc import Iterable
|
||||
import importlib.metadata
|
||||
import importlib.util
|
||||
import json
|
||||
|
|
@ -9,15 +10,19 @@ from typing import Final
|
|||
import unittest
|
||||
|
||||
|
||||
from packaging.utils import canonicalize_name
|
||||
|
||||
|
||||
def installed_versions(distributions: Iterable[importlib.metadata.Distribution]) -> dict[str, str]:
|
||||
return {canonicalize_name(distribution.metadata["Name"]): distribution.version for distribution in distributions}
|
||||
|
||||
|
||||
def main(profile: str, environment: Path) -> None:
|
||||
import litellm
|
||||
|
||||
package: Final = Path(litellm.__file__).resolve()
|
||||
assert package.is_relative_to(environment.resolve()), f"wrong wheel import: {package}"
|
||||
installed: Final = {
|
||||
distribution.metadata["Name"].lower().replace("_", "-"): distribution.version
|
||||
for distribution in importlib.metadata.distributions()
|
||||
}
|
||||
installed: Final = installed_versions(importlib.metadata.distributions())
|
||||
if profile == "core":
|
||||
assert all(importlib.util.find_spec(name) is None for name in ("mcp", "mcp_types", "httpx2", "httpcore2"))
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import importlib.metadata
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
@ -6,7 +7,7 @@ import zipfile
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.mcp_dependency_tests import runner
|
||||
from tests.mcp_dependency_tests import check_environment, runner
|
||||
|
||||
|
||||
def wheel(tmp_path: Path, name: str = "litellm") -> Path:
|
||||
|
|
@ -201,3 +202,13 @@ def test_proxy_rejects_missing_or_ambiguous_companions(tmp_path: Path, ambiguous
|
|||
companion.unlink()
|
||||
with pytest.raises(ValueError, match="exactly one enterprise"):
|
||||
runner.project_text(path, "proxy")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", ["Foo.Bar", "Foo__BAR", "foo--bar", "foo-bar"])
|
||||
def test_inventory_accepts_equivalent_distribution_names(tmp_path: Path, name: str) -> None:
|
||||
metadata = tmp_path / "foo_bar-1.dist-info"
|
||||
metadata.mkdir()
|
||||
(metadata / "METADATA").write_text(f"Metadata-Version: 2.1\nName: {name}\nVersion: 1\n")
|
||||
installed = check_environment.installed_versions(importlib.metadata.distributions(path=[str(tmp_path)]))
|
||||
runner.verify_inventory("foo-bar==1\n", {"environment": {}, "installed": installed}, {})
|
||||
assert installed == {"foo-bar": "1"}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue