Repository navigation
[CI][Tests] Stop leaking lazy vllm.envs values between tests - #50
Merged
Merged
Conversation
test_flash_next_batch_memory_and_explicit_off passed alone but failed after tests/v1/worker/test_gdn_spec_state_replay.py or test_gdn_replay_review_cpu.py in the same process. Those tests used monkeypatch.setattr(envs, NAME, value) on names that vllm.envs resolves lazily through module __getattr__: pytest records the resolved value as the old one and its undo writes it back as a concrete module attribute, which then shadows the environment for every later test. The acceleration test's setenv(NAME, "0") had no effect and VLLM_SM70_FUSED_SIGMOID_MIXED_QKV kept reason None. The two files now patch the environment (setenv, after dropping any existing shadow), which pytest restores exactly. As a guard, the acceleration test fixture drops concrete shadows of every declared env name, not only the DFlash2 verifier ones, and the assertion names the offending control when it fails. Tests only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Merged
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.
Change
tests/config/test_sm70_acceleration.py::test_flash_next_batch_memory_and_explicit_offpassed on its own but failed when it ran aftertests/v1/worker/test_gdn_spec_state_replay.pyortests/v1/worker/test_gdn_replay_review_cpu.pyin the same pytest process (for examplepytest tests/v1/worker/test_gdn_spec_state_replay.py tests/v1/worker/test_gdn_replay_review_cpu.py tests/config/test_gdn_replay_policy.py tests/config/test_sm70_acceleration.py→ 1 failed on main).Cause: those two files used
monkeypatch.setattr(envs, NAME, value)on names thatvllm.envsresolves lazily through its module__getattr__. pytest records the resolved value as the old one, and its undo writes that value back as a concrete module attribute where none existed. The attribute then shadows the environment for every later test, so the acceleration test'ssetenv("VLLM_SM70_FUSED_SIGMOID_MIXED_QKV", "0")had no effect and that control kept reasonNoneinstead ofuser_override.Fix, tests only:
setenv, after dropping any existing shadow), which pytest restores exactly. All the names involved are plain boolean environment getters read at call time.No runtime change; no effect on the support matrix.
Validation
CPU, in the ReVolta build image, each case a fresh pytest process:
vars(vllm.envs)andos.environaround every test) finds no attribute left behind. With only the fixture guard, the combination passes although the leak is still there.Attribution
Root cause and fix are the work of a local model: Qwen3.8-Flash-Next (Uncensored AWQ g32) served by ReVolta 0.1.4 on our 4 × V100 server, working through the pi coding agent. It bisected the order, wrote a leak probe, traced the mechanism to pytest's undo of attributes resolved through a module
__getattr__, fixed the tests and verified each half of the fix separately. Claude Code found the failing order while running the 0.1.5 changes together, reviewed the fix and opened this PR. Commits are signed off under the DCO.🤖 Generated with Claude Code