Skip to content

Fix render smoke test module docstring#27259

Closed
oss-agent-shin wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
oss-agent-shin:cursor/add-types-utils-docstring-ea41
Closed

Fix render smoke test module docstring#27259
oss-agent-shin wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
oss-agent-shin:cursor/add-types-utils-docstring-ea41

Conversation

@oss-agent-shin

Copy link
Copy Markdown
Contributor

Summary

litellm/proxy/types_utils/utils.py was 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:

python3 - <<'PY'
import ast
from pathlib import Path
path = Path('litellm/proxy/types_utils/utils.py')
module = ast.parse(path.read_text())
assert ast.get_docstring(module), f'{path} is missing a module docstring'
PY

Observed before the fix:

AssertionError: litellm/proxy/types_utils/utils.py is missing a module docstring

Evidence

Could not host image evidence via gist because $SHIN_GITHUB_TOKEN lacks the required gist scope (HTTP 404: This API operation needs the "gist" scope). Verbatim terminal transcript fallback:

$ python3 -m pytest tests/test_litellm/proxy/test_proxy_utils.py -vv
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /workspace
configfile: pyproject.toml
plugins: anyio-4.13.0
collecting ... collected 22 items

tests/test_litellm/proxy/test_proxy_utils.py::test_enrich_http_exception_callback_without_guardrail_name_noop PASSED [  4%]
tests/test_litellm/proxy/test_proxy_utils.py::test_enrich_http_exception_non_http_exception_noop PASSED [  9%]
tests/test_litellm/proxy/test_proxy_utils.py::test_enrich_http_exception_setdefault_does_not_overwrite PASSED [ 13%]
tests/test_litellm/proxy/test_proxy_utils.py::test_enrich_http_exception_string_detail_noop PASSED [ 18%]
tests/test_litellm/proxy/test_proxy_utils.py::test_enrich_http_exception_with_guardrail_context_dict_detail PASSED [ 22%]
tests/test_litellm/proxy/test_proxy_utils.py::test_get_custom_url PASSED [ 27%]
tests/test_litellm/proxy/test_proxy_utils.py::test_get_model_group_info_order PASSED [ 31%]
tests/test_litellm/proxy/test_proxy_utils.py::test_get_projected_spend_over_limit_day_one PASSED [ 36%]
tests/test_litellm/proxy/test_proxy_utils.py::test_get_projected_spend_over_limit_december PASSED [ 40%]
tests/test_litellm/proxy/test_proxy_utils.py::test_get_projected_spend_over_limit_includes_current_spend PASSED [ 45%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_both_empty PASSED [ 50%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_empty_base PASSED [ 54%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_empty_route PASSED [ 59%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_nested_path PASSED [ 63%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_no_duplication PASSED [ 68%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_normal_join PASSED [ 72%]
tests/test_litellm/proxy/test_proxy_utils.py::test_join_paths_with_trailing_slash PASSED [ 77%]
tests/test_litellm/proxy/test_proxy_utils.py::test_proxy_only_error_false_for_non_llm_non_info_route PASSED [ 81%]
tests/test_litellm/proxy/test_proxy_utils.py::test_proxy_only_error_false_for_other_error_type PASSED [ 86%]
tests/test_litellm/proxy/test_proxy_utils.py::test_proxy_only_error_true_for_info_route PASSED [ 90%]
tests/test_litellm/proxy/test_proxy_utils.py::test_proxy_only_error_true_for_llm_route PASSED [ 95%]
tests/test_litellm/proxy/test_proxy_utils.py::test_proxy_types_utils_has_module_docstring PASSED [100%]

======================== 22 passed, 2 warnings in 1.83s ========================

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) in tests/test_litellm/interactions/test_litellm_responses_bridge.py::TestLiteLLMResponsesBridge::test_acreate_simple and tests/test_litellm/test_compression.py::test_embedding_scorer.

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a missing module docstring to litellm/proxy/types_utils/utils.py (required by the render smoke test) and a regression test that asserts the docstring stays present.

  • litellm/proxy/types_utils/utils.py: One-line module docstring added at the top; no logic changed.
  • tests/test_litellm/proxy/test_proxy_utils.py: New test_proxy_types_utils_has_module_docstring test added that parses the source file with ast and asserts get_docstring returns a truthy value.

Confidence Score: 4/5

Safe 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.

Important Files Changed

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

Comment on lines 24 to +27

def test_proxy_types_utils_has_module_docstring():
path = Path("litellm/proxy/types_utils/utils.py")
module = ast.parse(path.read_text())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request May 6, 2026
- 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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants