项目文件夹

文件
wehub-resource-sync 78ec5d9290
ci-cd / build-axolotl-uv (<nil>, 130, 13.0.0, linux/amd64,linux/arm64, 3.12, 2.11.0) (push) Has been cancelled
ci-cd / build-axolotl-uv (<nil>, 130, 13.0.0, true, linux/amd64,linux/arm64, 3.12, 2.12.0) (push) Has been cancelled
ci-cd / build-axolotl-cloud-uv (<nil>, 130, 13.0.0, linux/amd64,linux/arm64, 3.12, 2.11.0) (push) Has been cancelled
ci-cd / build-axolotl-cloud-uv (<nil>, 130, 13.0.0, true, linux/amd64,linux/arm64, 3.12, 2.12.0) (push) Has been cancelled
ci-cd / build-axolotl-cloud-no-tmux-uv (<nil>, 130, 13.0.0, linux/amd64,linux/arm64, 3.12, 2.11.0) (push) Has been cancelled
ci-cd / build-axolotl-cloud-no-tmux-uv (<nil>, 130, 13.0.0, true, linux/amd64,linux/arm64, 3.12, 2.12.0) (push) Has been cancelled
ci-cd-base / build-base-uv (130, 13.0.0, , Dockerfile-uv-base, linux/amd64,linux/arm64, 3.12, 2.12.0, 9.0 10.0 10.3 12.0+PTX) (push) Has been cancelled
ci-cd-base / build-base-uv (130, 13.0.0, , Dockerfile-uv-base, linux/amd64,linux/arm64, 3.12, 2.12.1, 9.0 10.0 10.3 12.0+PTX) (push) Has been cancelled
ci-cd-base / build-base-uv (130, 13.0.0, , Dockerfile-uv-base, linux/amd64,linux/arm64, 3.12, 2.13.0, 9.0 10.0 10.3 12.0+PTX) (push) Has been cancelled
ci-cd-base / build-base-uv (132, 13.2.1, , Dockerfile-uv-base, linux/amd64,linux/arm64, 3.12, 2.13.0, 9.0 10.0 10.3 12.0+PTX, https://download.pytorch.org/whl/cu132) (push) Has been cancelled
ci-cd-base / build-base-uv (130, 13.0.0, , Dockerfile-uv-base, linux/amd64,linux/arm64, 3.12, 2.11.0, 9.0 10.0 10.3 12.0+PTX) (push) Has been cancelled
Tests / PyTest (3.12, 2.12.1) (push) Has been cancelled
Tests / PyTest (3.12, 2.13.0) (push) Has been cancelled
docker-e2e-tests / gate-skip-e2e (push) Has been cancelled
docker-e2e-tests / docker-e2e-tests-1st (<nil>, 130, 13.0.0, 1, 3.12, 2.12.1) (push) Has been cancelled
docker-e2e-tests / docker-e2e-tests (<nil>, 130, 13.0.0, 1, 3.12, 2.11.0) (push) Has been cancelled
docker-e2e-tests / docker-e2e-kernel-tests (<nil>, 130, 13.0.0, 1, 3.12, 2.11.0) (push) Has been cancelled
docker-e2e-tests / docker-e2e-kernel-tests (<nil>, 130, 13.0.0, 1, 3.12, 2.12.1) (push) Has been cancelled
docker-e2e-tests / docker-e2e-cleanup (<nil>, 130, 13.0.0, 1, 3.12, 2.12.1) (push) Has been cancelled
Publish Docs / build-deploy (push) Has been cancelled
Tests / PyTest from Source Dist (3.12, 2.11.0) (push) Has been cancelled
Tests / PyTest from Source Dist (3.12, 2.12.1) (push) Has been cancelled
Tests / PyTest from Source Dist (3.12, 2.13.0) (push) Has been cancelled
Tests / pre-commit (push) Has been cancelled
Tests / Prefetch S3 once to prime the CDN cache (push) Has been cancelled
Tests / PyTest (3.12, 2.11.0) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:48:45 +08:00

61 行
1.9 KiB
Python

"""Tests for axolotl vllm-serve CLI/config boolean precedence."""
import sys
import types
from unittest.mock import MagicMock
import pytest
from axolotl.cli.main import cli
from axolotl.utils.dict import DictDefault
@pytest.fixture
def stub_serve(monkeypatch):
"""Stub the serve module (no real vLLM server) and route load_cfg to a
config with the vLLM booleans enabled."""
name = "axolotl_stub_serve"
module = types.ModuleType(name)
module.main = MagicMock()
monkeypatch.setitem(sys.modules, name, module)
cfg = DictDefault(
{
"base_model": "dummy-model",
"vllm": {
"serve_module": name,
"enable_prefix_caching": True,
"enable_reasoning": True,
},
}
)
monkeypatch.setattr("axolotl.cli.vllm_serve.load_cfg", lambda *_, **__: cfg)
return module
@pytest.mark.parametrize(
"flags, expected",
[
(["--no-enable-prefix-caching", "--no-enable-reasoning"], False),
([], True),
],
)
def test_vllm_serve_bool_precedence(cli_runner, tmp_path, stub_serve, flags, expected):
"""`--no-<flag>` overrides a config-enabled option; omitting it keeps the config value.
Drives the real CLI so Click's ``--flag/--no-flag`` parsing and
``filter_none_kwargs`` run: an omitted flag reaches ``do_vllm_serve`` as
``None`` (config wins), ``--no-<flag>`` as ``False`` (overrides). Regression
for the ``cli or cfg`` bug where ``False or True`` -> ``True``.
"""
config = tmp_path / "config.yml"
config.write_text("base_model: dummy-model\n")
result = cli_runner.invoke(cli, ["vllm-serve", str(config), *flags])
assert result.exit_code == 0, result.output
stub_serve.main.assert_called_once()
script_args = stub_serve.main.call_args.args[0]
assert script_args.enable_prefix_caching is expected
assert script_args.enable_reasoning is expected