Repository navigation
[CI] Fix mock type narrowing in LoRA serving test - #59344
Merged
Merged
Conversation
Co-authored-by: Codex <noreply@openai.com> Signed-off-by: khluu <khluu000@gmail.com>
khluu
requested review from
AndreasKaratzas,
DarkLight1337,
NickLucche,
aarnphm and
robertgshaw2-redhat
as code owners
September 30, 2026 02:15
Member
|
How is this possible? All pre ommit checks passed in that PR. Weird ... |
AndreasKaratzas
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the main-branch pre-commit failure introduced by #59286 (failed job).
OpenAIServingModels.engine_clientis typed asEngineClient, so mypy seesadd_loraas an async method and rejectsassert_not_called(), even though the test creates it withMagicMock(spec=EngineClient).Assert that
add_lorais anAsyncMockbefore checking its call count. This narrows the type while preserving the regression test's guarantee that rejected adapter names never reach the engine. No production code changes.Searched open PRs for
59286 in:body,LoRA mypy, and"assert_not_called"; no existing PR addresses this failure.Validation
attr-definederror on unmodified main with the repository's mypy 1.20.2 wrapper..venv/bin/pre-commit run --files tests/entrypoints/serve/lora/test_serving_models.py --hook-stage manual— all applicable hooks passed, including mypy for Python 3.10, 3.11, 3.12, and 3.13.EngineClientclass definition: itsMagicMockproduces anAsyncMockforadd_lora, andassert_not_called()rejects an unexpected call.git diff --checkpassed.AI assistance: prepared and validated with Codex.
Why #59286 passed before merging
Its passing pre-commit run tested merge commit
4865d3eagainst base7aa8372and finished at 2026-09-29 19:39 UTC. At that point,tests/entrypoints/serveused--follow-imports skip.At 20:27 UTC, #51043 (
5dd693122c) merged and moved this directory toSILENT_GROUPS, enablingfollow_imports="silent". #59286 merged at 2026-09-30 01:29 UTC, after that stricter check landed. The earlier green run therefore did not validate their combined state.Confirmed on the same unfixed test with mypy 1.20.2:
--follow-imports skippasses;--follow-imports silentreproduces the exact line-115attr-definederror. Skipping imports hides the imported EngineClient method type; following imports exposes it.