ComfyUI/tests-unit
Claude ec820735c7
Simplify api docs module and tests
Cleanup pass over the previous commit. No behaviour change except the
cache header noted below.

app/api_docs.py (111 -> 59 lines):

- Cut the rationale comments. The file was ~32% commentary against 2-6%
  in neighbouring app/ modules, and most of it argued decisions that
  belong in the PR rather than the source, including a TODO explaining
  why an SRI hash could not be computed.
- Inline the spec and bundle URLs into the HTML. The __TOKEN__ replace()
  machinery existed only to hoist two string literals, and then needed a
  comment defending its own existence.
- Drop the hand-rolled <style> block for two inline style attributes.
- Drop the os.path.isfile guard. FileResponse already answers a missing
  file with a 404, so the check was a second stat for the same result.

- Serve the spec with Cache-Control: no-cache rather than no-store.
  Both mean "never use a stale copy", but no-store also forbids storing
  it, so every docs page load re-transferred all 230 KB. no-cache lets
  the browser revalidate against the ETag FileResponse already sets; an
  unchanged spec now costs a 304 instead of a full download.

tests-unit/server_test/test_api_docs.py (11 tests -> 6, 144 -> 70 lines):

- Drop the local copy of server.py's /api prefix loop and the two tests
  that depended on it. They exercised the copy, not the real loop, so
  they would have stayed green through a change to the thing they
  claimed to protect. What actually makes prefixing work is that the
  spec URL is relative, which is now asserted directly.
- Drop the static-catch-all test. It asserted aiohttp's own route
  precedence against a synthetic app, and could not fail if the
  registration call moved after the catch-all in server.py.
- Drop the tautological SPEC_PATH assertion, already covered by fetching
  the spec through the route.
- Loosen the fallback assertions, which pinned the exact quoting and
  inline-handler style of the HTML.

Claude-Session: https://claude.ai/code/session_01BvUveU9ofyGrSz3QxYeecB
2026-08-14 23:49:26 +00:00
..
app_test feat(api): expose registered extension filters on /experiment/models (#14797) 2026-07-09 12:59:30 -07:00
assets_test Add tags_all / tags_any / tags_none tag filters to the assets list API (#15332) 2026-08-10 14:05:21 -07:00
comfy_api_nodes_test [Partner Nodes] fix(ByteDance): encode stereo reference audio without doubling its duration (#15177) 2026-07-31 21:57:45 +03:00
comfy_api_test Store mp4 metadata at the beginning of the file when possible. (#15195) 2026-08-01 03:21:28 -04:00
comfy_extras_test Fix PreviewAny escaping non-ASCII text in dict and list previews (#15513) 2026-08-11 23:42:35 -07:00
comfy_quant Support convrot int4 models. (#14859) 2026-07-09 18:57:09 -04:00
comfy_test Fix Generate Text ignoring thinking=false on Gemma4 E2B/E4B (#15278) 2026-08-12 22:44:14 -04:00
execution_test feat(assets): include asset id in executed WebSocket message (#13862) 2026-06-10 17:04:52 -07:00
folder_paths_test feat(security): add System User protection with `__` prefix (#10966) 2025-11-28 21:28:42 -05:00
jobs_cancel_test Add jobs-namespace cancel endpoints (POST /api/jobs/{job_id}/cancel, POST /api/jobs/cancel) (#14493) 2026-06-19 16:39:35 -07:00
prompt_server_test fix: return millisecond timestamps from get_file_info() (#12996) 2026-05-06 10:56:09 +08:00
security_test Fix SVG previews broken by the stored-XSS forced-download (#15149) 2026-07-29 23:29:36 -07:00
seeder_test feat(assets): register output files as assets after prompt execution (#12812) 2026-03-24 20:48:55 -07:00
server/utils Remove unused GET /files API endpoint (#6714) 2025-02-05 18:48:36 -05:00
server_test Simplify api docs module and tests 2026-08-14 23:49:26 +00:00
utils Normalize extra_model_config.yaml paths to prevent duplicates. (#6885) 2025-02-20 07:09:45 -05:00
README.md Minor: update tests-unit README.md (#4896) 2024-09-12 04:53:08 -04:00
deploy_environment_test.py Add deploy environment header (Comfy-Env) to partner node API calls (#13425) 2026-05-04 20:17:56 -07:00
feature_flags_test.py feat: allow --comfy-api-base target ephemeral testenvs (#14569) 2026-07-08 23:20:10 -07:00
requirements.txt refactor(assets): modular architecture + async two-phase scanner & background seeder (#12621) 2026-03-07 20:37:25 -05:00
websocket_feature_flags_test.py feat(assets): add namespaced model_type tags and align tag semantics (#14511) 2026-07-08 22:00:08 -07:00

README.md

Pytest Unit Tests

Install test dependencies

pip install -r tests-unit/requirements.txt

Run tests

pytest tests-unit/