test: expand OpenAI serving chat coverage - #65
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97ea40859d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not hasattr(paddle, "compat"): | ||
| paddle.compat = types.SimpleNamespace(enable_torch_proxy=lambda *args, **kwargs: None) |
There was a problem hiding this comment.
Avoid masking missing paddle.compat in tests
Injecting a stub paddle.compat here means the tests will pass even if the installed Paddle build doesn’t actually provide compat, but production code still calls paddle.compat.enable_torch_proxy unguarded (see fastdeploy/__init__.py:52). In environments with older Paddle versions, this shim hides the real import-time failure, so CI can green‑light an unsupported configuration that would crash at runtime. Consider skipping these tests or gating on Paddle version instead of patching the global module.
Useful? React with 👍 / 👎.
Motivation
fastdeploy.entrypoints.openai.serving_chatby exercising logprobs decoding, error paths, and request lifecycle variants.Description
_make_logprobs_lists,_make_handler, and_setup_semaphore, plus a smallpaddle.compatshim and additional imports (DeltaMessage,LogProbEntry,StreamOptions,ErrorCode,ParameterError,numpy) to support richer fixtures intests/entrypoints/openai/test_serving_chat.py.test_build_prompt_logprobs_no_decode,test_build_logprobs_response_*(invalid request, decode errors, byte replacement),test_create_chat_logprobs_*(invalid input, multiple steps, request false), andtest_make_logprob_dict_*edge cases.create_chat_completiontests covering non-master and unsupported model handling,ParameterErrorand formatter error handling, request id prefixing and preservation, numpy prompt ids for streaming, streaming multimodal usage, full-generator behavior with draft and prompt logprobs, and finish-reason variants for choices.Testing
PYTHONPATH=. pytest -q tests/entrypoints/openai/test_serving_chat.pywhich completed successfully with40 passedand warnings observed.coverage run -m pytest -q tests/entrypoints/openai/test_serving_chat.pywhich passed and was followed bycoverage report -m --include="fastdeploy/entrypoints/openai/serving_chat.py" --fail-under=85reporting89%coverage forserving_chat.py.pre-commit run --files tests/entrypoints/openai/test_serving_chat.pywhich passed all configured hooks.Codex Task