Repository navigation
[Test] [AMD] diffusion: Avoid Python 3.11-only enterContext in test_usp_ring_replicated - #45409
Merged
Merged
Conversation
unittest.TestCase.enterContext is Python 3.11+, and the rocm720 image runs Python 3.10, so every test in the file errors in setUp. Start the patcher and register its stop with addCleanup instead.
michaelzhang-ai
marked this pull request as ready for review
October 20, 2026 20:49
michaelzhang-ai
requested review from
AgainstEntropy,
HaiShaw,
kevin-mii,
mickqian,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 20, 2026 20:49
This was referenced Oct 22, 2026
This was referenced Oct 29, 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.
What
Replace
self.enterContext(patch(...))inRingReplicatedBase.setUp(python/sglang/multimodal_gen/test/unit/test_usp_ring_replicated.py) withpatcher.start()plusself.addCleanup(patcher.stop).Why
unittest.TestCase.enterContextwas added in Python 3.11. #44690 introduced this call, and on the rocm720 image (Python 3.10) all four tests in the file error insetUpwithAttributeError: 'TestRingReplicatedPrefix' object has no attribute 'enterContext'. The rocm10 image runs Python 3.12 and passes.Failing job:
The replacement is the standard 3.10-compatible equivalent and keeps the same lifetime: the patch is active for the test and removed in cleanup.
Test plan
python -m py_compileon the changed file passes.enterContextcall remains underpython/sglang/multimodal_gen.multimodal-gen-test-1-gpu-amdrun on this commit: https://github.com/sgl-project/sglang/actions/runs/39461784145/job/118763009086 (all 5 tests intest_usp_ring_replicated.pypassed). The other failures in that run are in files this PR does not touch.CI States
Latest PR Test (Base): ✅ Run #39450136803
Latest PR Test (Extra): ❌ Run #39450136708
Latest PR Test (AMD ROCm 10): ❌ Run #39450136610