mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-18 13:07:28 +08:00
Per @rattus128 review on PR #13685: silently coercing typo'd bool values (e.g. `--feature-flag show_signin_button=ture`) to `False` was a confusing UX. Make bool coercion strict and drop unparseable flags entirely. - `_coerce_bool`: accept only `true`/`false` (case-insensitive); raise `ValueError` for anything else (`ture`, `yes`, `1`, ``). - `_coerce_flag_value`: no longer swallows exceptions; raises on bad coercion so the caller decides what to do. - `_parse_cli_feature_flags`: catches `ValueError`/`TypeError`, logs a warning ("dropping flag"), and omits the flag from the result. ComfyUI still starts; `SERVER_FEATURE_FLAGS` retains the registered default; other valid `--feature-flag` entries on the same command line are unaffected. Tests: - `test_bool_typo_raises`: `ture`/`yes`/`1`/`""` all raise ValueError. - `test_failed_int_coercion_raises`: replaces the old "falls back to string" test now that coercion failures propagate. - `test_invalid_bool_value_dropped`: parser drops the bad flag and logs a warning, while a valid sibling flag still parses. 19/19 unit tests pass. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019df5a8-36be-7107-a4af-c7e4f51687df |
||
|---|---|---|
| .. | ||
| app_test | ||
| assets_test | ||
| comfy_api_test | ||
| comfy_extras_test | ||
| comfy_quant | ||
| comfy_test | ||
| execution_test | ||
| folder_paths_test | ||
| prompt_server_test | ||
| seeder_test | ||
| server/utils | ||
| server_test | ||
| utils | ||
| feature_flags_test.py | ||
| README.md | ||
| requirements.txt | ||
| websocket_feature_flags_test.py | ||
Pytest Unit Tests
Install test dependencies
pip install -r tests-unit/requirements.txt
Run tests
pytest tests-unit/