[Misc] Replace os environ to monkeypatch in test suite (#14516)
Signed-off-by: sibi <85477603+t-sibiraj@users.noreply.github.com> Signed-off-by: Aaron Pham <contact@aarnphm.xyz> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Co-authored-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
@@ -56,12 +56,11 @@ def test_gc():
|
||||
assert allocated < 50 * 1024 * 1024
|
||||
|
||||
|
||||
def test_model_from_modelscope(monkeypatch):
|
||||
def test_model_from_modelscope(monkeypatch: pytest.MonkeyPatch):
|
||||
# model: https://modelscope.cn/models/qwen/Qwen1.5-0.5B-Chat/summary
|
||||
MODELSCOPE_MODEL_NAME = "qwen/Qwen1.5-0.5B-Chat"
|
||||
monkeypatch.setenv("VLLM_USE_MODELSCOPE", "True")
|
||||
try:
|
||||
llm = LLM(model=MODELSCOPE_MODEL_NAME)
|
||||
with monkeypatch.context() as m:
|
||||
m.setenv("VLLM_USE_MODELSCOPE", "True")
|
||||
llm = LLM(model="qwen/Qwen1.5-0.5B-Chat")
|
||||
|
||||
prompts = [
|
||||
"Hello, my name is",
|
||||
@@ -73,10 +72,3 @@ def test_model_from_modelscope(monkeypatch):
|
||||
|
||||
outputs = llm.generate(prompts, sampling_params)
|
||||
assert len(outputs) == 4
|
||||
finally:
|
||||
monkeypatch.delenv("VLLM_USE_MODELSCOPE", raising=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import pytest
|
||||
pytest.main([__file__])
|
||||
|
||||
Reference in New Issue
Block a user