Fix render smoke test module docstring#27259
Conversation
Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>
|
|
Greptile SummaryThis PR adds a missing module docstring to
Confidence Score: 4/5Safe to merge; the only change to production code is adding a one-line docstring. The production code change is trivially safe. The regression test does its job but resolves the source file via a hardcoded relative path, which will raise FileNotFoundError rather than a meaningful assertion failure if pytest is invoked from any directory other than the repo root. tests/test_litellm/proxy/test_proxy_utils.py — relative path in the new test.
|
| Filename | Overview |
|---|---|
| litellm/proxy/types_utils/utils.py | Adds a one-line module docstring; no logic changes. |
| tests/test_litellm/proxy/test_proxy_utils.py | Adds a regression test for the module docstring; uses a hardcoded relative path that could break when pytest is run from a non-root directory. |
Reviews (1): Last reviewed commit: "Add proxy types utils module docstring" | Re-trigger Greptile
|
|
||
| def test_proxy_types_utils_has_module_docstring(): | ||
| path = Path("litellm/proxy/types_utils/utils.py") | ||
| module = ast.parse(path.read_text()) |
There was a problem hiding this comment.
Hardcoded relative path breaks test when CWD differs
Path("litellm/proxy/types_utils/utils.py") is resolved relative to whatever directory pytest is invoked from. If the test suite is run from a subdirectory (or via a CI step that changes directories), path.read_text() raises FileNotFoundError rather than the intended AssertionError, masking the actual intent. Anchoring to the test file's own location makes it runner-independent.
Additionally, adding an assertion message (e.g. assert ast.get_docstring(module), f"{path} is missing a module docstring") makes failures self-explanatory without digging into the traceback.
- BerriAI/litellm#27266 handle response.incomplete in Responses->Chat transform [merge-after-nits] - BerriAI/litellm#27259 add module docstring + regression test for render smoke [merge-as-is] - google-gemini/gemini-cli#26559 implement OIDC auth provider for A2A remote agents [merge-after-nits] - QwenLM/qwen-code#3861 preserve comments via comment-json on settings migration [merge-after-nits]
Summary
litellm/proxy/types_utils/utils.pywas missing the module docstring required by the render smoke test. Added a one-line module docstring describing the proxy type utility helpers and a regression test that asserts the docstring remains present.Repro
On the starting ref (
litellm_internal_staging), run:Observed before the fix:
Evidence
Could not host image evidence via gist because
$SHIN_GITHUB_TOKENlacks the requiredgistscope (HTTP 404: This API operation needs the "gist" scope). Verbatim terminal transcript fallback:Tests
python3 - <<'PY' ... ast.get_docstring(...) ... PY— passes after the fix.python3 -m pytest tests/test_litellm/proxy/test_proxy_utils.py::test_proxy_types_utils_has_module_docstring -vv— passed.python3 -m pytest tests/test_litellm/proxy/test_proxy_utils.py -vv— 22 passed, 2 warnings.make test-unit— ran 5,159 passing tests before stopping on 2 unrelated live OpenAI authentication failures (invalid_api_key) intests/test_litellm/interactions/test_litellm_responses_bridge.py::TestLiteLLMResponsesBridge::test_acreate_simpleandtests/test_litellm/test_compression.py::test_embedding_scorer.