test: no regression test for the `--cpu` torch branch fixed in #344
Maintainer thường phản hồi trong vòng 1 ngày
@bigcat88 đang làm issue này rồi.
Từ ngày 21/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Missing Regression Test
Original bug: #344 — comfy-cli install --cpu still installs CUDA version of PyTorch
Fix PR: #345 (merged 2026-01-05)
PR #345 changed comfy_cli/command/install.py only — +21 -0, no test files. The CPU branch it added is still the fix in place today:
# comfy_cli/command/install.py:75-76
if gpu is None:
result = _pip_install_torch(python, ["--extra-index-url", "https://download.pytorch.org/whl/cpu"])
Why this gap matters
TestTorchInstallCommands (tests/comfy_cli/test_install_python_resolution.py:281) parametrizes every other branch of that same if-chain:
- 6 ROCm versions —
:285-290 - 5 CUDA versions —
:317-321 - NVIDIA-on-Linux —
:344
gpu is None is the one branch with no case. Delete install.py:75-76 and the entire suite stays green, while comfy install --cpu silently reinstalls a CUDA build — the original #344 symptom, verbatim.
Control for the "surely something covers it" reaction: the only whl/cpu assertion anywhere in tests/ is tests/uv/test_torch_backend_compile.py:74, and it exercises DependencyCompiler (comfy_cli/uv.py), the --fast-deps path — a different function from the one #345 fixed. It is an adjacent code path, not the failure path.
$ git grep -n 'whl/cpu' origin/main -- tests/
tests/uv/test_torch_backend_compile.py:74: assert "download.pytorch.org/whl/cpu" in content
tests/comfy_cli/test_install_python_resolution.py:19 does pass gpu=None, but asserts only cmd[0] == "/resolved/python" — it would pass with the CPU branch deleted, because the requirements.txt subprocess call alone satisfies it.
Suggested test
- Layer: unit
- File:
tests/comfy_cli/test_install_python_resolution.py, appended to the existingTestTorchInstallCommands - Asserts: the torch install command for
gpu=Nonecontainshttps://download.pytorch.org/whl/cpuand contains nowhl/cu*index
Patch below applies to origin/main and matches the surrounding style, reusing the file's existing _get_torch_install_cmd helper.
Proposed patch
--- a/tests/comfy_cli/test_install_python_resolution.py
+++ b/tests/comfy_cli/test_install_python_resolution.py
@@ -361,3 +361,26 @@ class TestTorchInstallCommands:
cmd = _get_torch_install_cmd(mock_run.call_args_list)
assert "--index-url" in cmd
assert "https://download.pytorch.org/whl/cu126" in cmd
+
+ def test_cpu_uses_cpu_wheel_index(self, tmp_path):
+ """Regression test for #344: `--cpu` must not fall through to a CUDA wheel.
+
+ `gpu is None` is the CPU branch (comfy_cli/command/install.py:75-76). Every
+ other branch of that if-chain is parametrized above; this one was not, so
+ deleting the branch left the whole suite green while `comfy install --cpu`
+ silently installed the default CUDA build again.
+ """
+ repo_dir = str(tmp_path)
+ (tmp_path / "requirements.txt").write_text("some-package\n")
+
+ with patch("comfy_cli.command.install.subprocess.run", return_value=MagicMock(returncode=0)) as mock_run:
+ install.pip_install_comfyui_dependencies(
+ repo_dir,
+ gpu=None,
+ plat=constants.OS.LINUX,
+ cuda_version=constants.CUDAVersion.v12_6,
+ skip_torch_or_directml=False,
+ skip_requirement=False,
+ python="/usr/bin/python",
+ )
+
+ cmd = _get_torch_install_cmd(mock_run.call_args_list)
+ assert cmd is not None, "no torch install command was issued for the CPU path"
+ assert "https://download.pytorch.org/whl/cpu" in cmd
+ assert not any(a.startswith("https://download.pytorch.org/whl/cu") for a in cmd)
Not executed. The audit box has no typer installed and the run was under a no-install constraint, so this patch is offered unverified rather than with a red/green result. It is written against the file's existing helper and fixtures; please run it before merging.
Affected code
comfy_cli/command/install.py:75-76— the fix, still presenttests/comfy_cli/test_install_python_resolution.py:281-361— the class that covers every sibling branch
Filed by a closed-bug regression audit (Comfy-Org/comfy-cli, origin/main @ 3ff9f55).
- Ngôn ngữ chính
- Python
- Star
- 1k
- Fork
- 176
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 87
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Comfy-Org/comfy-cli
-
test_file_utils umask tests assert against a umask the code never reads (import-time _UMASK), so they only pass on a 0o022 hostCó thể đã có người làm @neverbiasu đã nhận 10 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Comfy-Org/comfy-cli#907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Comfy-Org/comfy-cli#781 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`comfy launch --background` fails with FileNotFoundError when comfy-cli is invoked by pathCó thể đã có người làm @RaphaelFakhri đã nhận 42 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Comfy-Org/comfy-cli#691 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Comfy-Org/comfy-cli#670 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Comfy-Org/comfy-cli
Issue tương tự
-
add entry to blockĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
StevenBlack/hosts#3299 ·
-
`garak --report` overwrites the input report when its name has no ".report"Có thể đã có người làm @0z5a đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
plot_graph crashes when a mesh node has no m2m edgeCó thể đã có người làm @tygvi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mllam/neural-lam#883 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
future-agi/future-agi#4092 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
transcript analytics: a text whose only protected spans the prose pass redacts is withheld wholeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
WingedGuardian/GENesis-AGI#4641 ·
Maintainer thường phản hồi trong vòng 1 ngày