Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
test: keep generation_devices copy check inside the Python tree
Josh Corbett91bc7065fd5c
diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.ymlindex a7dd9128b2..43ecc7590d 100644--- a/.github/workflows/python-tests.yml+++ b/.github/workflows/python-tests.yml@@ -95,13 +95,8 @@ jobs:# test_imports.py walks every package, including the frontend ones.- 'invokeai/frontend/web/**/*.py'- 'invokeai/frontend/webv2/**/*.py'- # Non-Python files that tests read.- # test_workflow_graph_builder.py validates these fixtures against the backend.+ # test_workflow_graph_builder.py validates these editor fixtures against the backend.- 'invokeai/frontend/webv2/src/features/workflow/core/fixtures/**'- # test_config_generation_devices.py checks these against the config field description.- - 'invokeai/frontend/web/public/locales/en.json'- - 'docs/src/generated/settings.json'- - 'docs/src/content/docs/configuration/invokeai-yaml.mdx'- 'tests/**'# tests/ covers a few of these (e.g. test_check_pins.py, test_docs_json_export.py)- 'scripts/**'diff --git a/tests/AGENTS.md b/tests/AGENTS.mdindex 760c3f8029..123090b1ac 100644--- a/tests/AGENTS.md+++ b/tests/AGENTS.md@@ -1,6 +1,6 @@# Python tests-- Read guidance for the production code under test. Follow existing suite placement (`tests/app/`, `tests/backend/`, or the owning root suite) and reuse appropriate fixtures from `conftest.py` and `fixtures/`. A test that reads a file outside `tests/`, `scripts/`, or the Python package tree (for example `docs/` or `invokeai/frontend/web*`) must add that path to the change filter in `.github/workflows/python-tests.yml`, or CI skips pytest when only that file changes.+- Read guidance for the production code under test. Follow existing suite placement (`tests/app/`, `tests/backend/`, or the owning root suite) and reuse appropriate fixtures from `conftest.py` and `fixtures/`. Keep tests inside the Python tree's contracts: UI copy and docs prose belong to their own packages' checks. A test that must read a file outside `tests/`, `scripts/`, or the Python package tree (a shared contract fixture, for example) must add that path to the change filter in `.github/workflows/python-tests.yml`, or CI skips pytest when only that file changes.- Protect observable behavior at the interface that owns it. A test should fail for a plausible regression, use independently derived expectations, and survive implementation refactors that preserve the contract.- Avoid trivial type/constant/re-export tests, snapshots of incidental structure, duplicate coverage, implementation-shaped mock choreography, and benchmarks without a meaningful question. Remove obsolete tests.- Reproduce bugs with a focused failing case when feasible. Add edge/failure cases where they protect real behavior, not every imaginable branch. Use names describing outcomes.diff --git a/tests/app/services/config/test_config_generation_devices.py b/tests/app/services/config/test_config_generation_devices.pyindex cd162dd366..f04368c942 100644--- a/tests/app/services/config/test_config_generation_devices.py+++ b/tests/app/services/config/test_config_generation_devices.py@@ -43,33 +43,14 @@ def test_invalid_device_name_is_rejected():def test_auto_copy_documents_legacy_device_precedence():"""`generation_devices: auto` resolves to the single pinned legacy `device` when one is set- (see TorchDevice.get_generation_devices), so every user-facing description of `auto` must- disclose that exception instead of promising "every available GPU" unconditionally. Checks the- schema description (source of the API docs and generated settings docs), the generated docs- settings.json, the Settings UI copy, and the configuration guide's behavior table."""- import json- from pathlib import Path-- repo_root = Path(__file__).parents[4]-+ (see TorchDevice.get_generation_devices), so the schema description must disclose that+ exception instead of promising "every available GPU" unconditionally. The API docs and the+ generated settings docs derive from this description; the docs workflow's check-docs-data+ step fails when the generated copy is stale. UI and guide copy belong to their own packages."""field_description = InvokeAIAppConfig.model_fields["generation_devices"].descriptionassert field_description is not Noneassert "legacy `device`" in field_description- generated_settings = json.loads((repo_root / "docs/src/generated/settings.json").read_text())- generated_description = next(- s["description"] for s in generated_settings["settings"] if s["name"] == "generation_devices"- )- assert "legacy `device`" in generated_description-- locales = json.loads((repo_root / "invokeai/frontend/web/public/locales/en.json").read_text(encoding="utf-8"))- assert locales["settings"]["generationDevicesAuto"] == "Auto" # not "Auto (all GPUs)"- assert "'device'" in locales["settings"]["generationDevicesHelp"]-- guide = (repo_root / "docs/src/content/docs/configuration/invokeai-yaml.mdx").read_text(encoding="utf-8")- auto_row = next(line for line in guide.splitlines() if line.startswith("| `auto`"))- assert "legacy `device`" in auto_row-@pytest.mark.parametrize("value", [["xpu:x"], ["xpu:"], ["xpu0"]])def test_malformed_xpu_device_is_rejected(value):