Skip to content

[release/2.57.0][core] Import pytest lazily in test_utils to fix runtime_env_container tests (#64762) - #64972

Merged
elliot-barn merged 1 commit into
releases/2.57.0from
cp-2.57.0-64762
Aug 3, 2026
Merged

elliot-barn merged 1 commit into
releases/2.57.0from
cp-2.57.0-64762

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

Cherry-pick of #64762 (934eda2) to releases/2.57.0.

Description

Fixes the runtime env container tests failure on the release branch (postmerge build 18756): test_serve_telemetry[True/False] fail with ModuleNotFoundError: No module named 'pytest' because ray/serve/_private/test_utils.py imports pytest at module level, and the scripts in test_runtime_env_container run inside a Ray image which does not have pytest installed. This change moves the import inside the functions that need it.

🤖 Generated with Claude Code

…r tests (#64762)

## Description
The scripts in `test_runtime_env_container` run inside a Ray image,
which does not have pytest installed, so we can't add at the top level
file but inside functions which only be called in pytest environment.

Signed-off-by: yicheng <[email protected]>
Co-authored-by: yicheng <[email protected]>
(cherry picked from commit 934eda2)
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn requested a review from a team as a code owner July 23, 2026 21:43

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request refactors python/ray/serve/_private/test_utils.py by moving the global import of pytest to a local import inside the skip_if_haproxy function. There are no review comments, so no feedback is provided.

@elliot-barn
elliot-barn enabled auto-merge (squash) July 23, 2026 21:46
@elliot-barn elliot-barn added the go add ONLY when ready to merge, run all tests label Jul 23, 2026
@ray-gardener ray-gardener Bot added serve Ray Serve Related Issue release-test release test labels Jul 24, 2026
@elliot-barn
elliot-barn disabled auto-merge August 3, 2026 17:57
@elliot-barn
elliot-barn merged commit 8d36c02 into releases/2.57.0 Aug 3, 2026
6 of 7 checks passed
@elliot-barn
elliot-barn deleted the cp-2.57.0-64762 branch August 3, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests release-test release test serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants