Skip to content

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.

perf(model-manager): probe GGUF files without a full collection; drop dead tests (#10301)

Alexander Eichhorn471bb0f4de2d
diff --git a/docs/src/content/docs/development/Guides/tests.mdx b/docs/src/content/docs/development/Guides/tests.mdx
index dd84717e94..844c294a2e 100644
--- a/docs/src/content/docs/development/Guides/tests.mdx
+++ b/docs/src/content/docs/development/Guides/tests.mdx
@@ -74,39 +74,7 @@ Most backend tests live in the [`tests/`](https://github.com/invoke-ai/InvokeAI/
### Tests that depend on models
-There are a few things to keep in mind when adding tests that depend on models.
-
-1. If a required model is not already present, it should automatically be downloaded as part of the test setup.
-2. If a model is already downloaded, it should not be re-downloaded unnecessarily.
-3. Take reasonable care to keep the total number of models required for the tests low. Whenever possible, re-use models that are already required for other tests. If you are adding a new model, consider including a comment to explain why it is required/unique.
-
-There are several utilities to help with model setup for tests. Here is a sample test that depends on a model:
-
-```python
-import pytest
-import torch
-
-from invokeai.backend.model_management.models.base import BaseModelType, ModelType
-from invokeai.backend.util.test_utils import install_and_load_model
-
-def test_model(model_installer, torch_device):
- model_info = install_and_load_model(
- model_installer=model_installer,
- model_path_id_or_url="HF/dummy_model_id",
- model_name="dummy_model",
- base_model=BaseModelType.StableDiffusion1,
- model_type=ModelType.Dummy,
- )
-
- dummy_input = build_dummy_input(torch_device)
-
- with torch.no_grad(), model_info as model:
- model.to(torch_device, dtype=torch.float32)
- output = model(dummy_input)
-
- # Validate output...
-```
+Tests do not download models routinely, and there is no shared helper that installs one. Prefer small CPU fixtures built in the test. A test that needs a real model must be marked `slow` (excluded by default and in CI) and must not download large models unless it is run on purpose. Keep the total number of models the slow tests need low, re-use models other tests already need, and comment why a new one is required.
### Test Coverage
diff --git a/invokeai/backend/AGENTS.md b/invokeai/backend/AGENTS.md
index b5cafa834e..f9454d5f30 100644
--- a/invokeai/backend/AGENTS.md
+++ b/invokeai/backend/AGENTS.md
@@ -19,7 +19,7 @@
## Verification
-- Read `tests/AGENTS.md` and relevant suites in `tests/backend/`, `tests/model_identification/`, `tests/test_model_manager/`.
+- Read `tests/AGENTS.md` and relevant suites in `tests/backend/`, `tests/model_identification/`.
- Small CPU fixtures plus targeted device checks. Use real tensor operations: they expose shape/dtype/numerical/memory errors mocks hide.
- Cover affected failure cleanup, unsupported configurations, boundary shapes, cancellation. Unit tests never use user model/output directories and never routinely download large models.
- Run focused pytest and root Ruff. Material inference changes: report hardware, dtype, shapes, measurements, untested platforms/model paths. CPU passes do not prove accelerator behavior.
diff --git a/invokeai/backend/quantization/gguf/loaders.py b/invokeai/backend/quantization/gguf/loaders.py
index 8478216941..996623f963 100644
--- a/invokeai/backend/quantization/gguf/loaders.py
+++ b/invokeai/backend/quantization/gguf/loaders.py
@@ -1,4 +1,3 @@
-import gc
import json
import math
import re
@@ -74,11 +73,13 @@ class WrappedGGUFReader:
return False
def close(self):
- """Drop this wrapper's references to the reader and its memory map, then collect.
+ """Drop this wrapper's references to the reader and its memory map.
- The map closes once nothing references it. A caller's `with WrappedGGUFReader(path) as reader:` keeps the
- reader, and through its tensor views the map, until that name goes out of scope -- for the callers here,
- when they return -- so the collection releases only what reference cycles would otherwise hold.
+ The map closes once nothing references it, by reference count: the reader holds no cycle, so no collection
+ runs (a full one costs most of a second on a loaded process). A caller's
+ `with WrappedGGUFReader(path) as reader:` keeps the reader, and through its tensor views the map, until
+ that name goes out of scope -- for the callers here, when they return -- so the file can be deleted or
+ moved once the caller has returned, provided nothing it returned still views the file's data.
"""
if hasattr(self.reader, "data"):
try:
@@ -87,15 +88,13 @@ class WrappedGGUFReader:
except (AttributeError, OSError, ValueError) as e:
logger.warning(f"Wasn't able to close GGUF memory map: {e}")
del self.reader
- gc.collect()
def gguf_tensor_bytes(path: Path) -> dict[str, int]:
"""The stored size of each of a GGUF file's tensors, by name, from its header alone; no tensor data is read.
For a loader that decides from the names which tensors to read, and sizes what it will read. The reader is
- referenced by this expression only, so the memory map is released as soon as the sizes are read, without the
- full collection `WrappedGGUFReader.close` runs, which costs most of a second on a loaded process (measured on
+ referenced by this expression only, so the memory map is released as soon as the sizes are read (measured on
Windows, where a file still mapped cannot be deleted: it deletes at once with the collector disabled).
"""
return {tensor.name: int(tensor.n_bytes) for tensor in _open_gguf_reader(path).tensors}
diff --git a/invokeai/backend/util/test_utils.py b/invokeai/backend/util/test_utils.py
deleted file mode 100644
index a64919ca4b..0000000000
--- a/invokeai/backend/util/test_utils.py
+++ /dev/null
@@ -1,68 +0,0 @@
-import contextlib
-from pathlib import Path
-from typing import Optional, Union
-
-import pytest
-import torch
-
-from invokeai.app.services.model_manager import ModelManagerServiceBase
-from invokeai.app.services.model_records import UnknownModelException
-from invokeai.backend.model_manager.load.load_base import LoadedModel
-from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelType, SubModelType
-
-
[email protected](scope="session")
-def torch_device():
- if torch.cuda.is_available():
- return "cuda"
- if hasattr(torch, "xpu") and torch.xpu.is_available():
- return "xpu"
- return "cpu"
-
-
-def install_and_load_model(
- model_manager: ModelManagerServiceBase,
- model_path_id_or_url: Union[str, Path],
- model_name: str,
- base_model: BaseModelType,
- model_type: ModelType,
- submodel_type: Optional[SubModelType] = None,
-) -> LoadedModel:
- """Install a model if it is not already installed, then get the LoadedModel for that model.
-
- This is intended as a utility function for tests.
-
- Args:
- mm2_model_manager (ModelManagerServiceBase): The model manager
- model_path_id_or_url (Union[str, Path]): The path, HF ID, URL, etc. where the model can be installed from if it
- is not already installed.
- model_name (str): The model name, forwarded to ModelManager.get_model(...).
- base_model (BaseModelType): The base model, forwarded to ModelManager.get_model(...).
- model_type (ModelType): The model type, forwarded to ModelManager.get_model(...).
- submodel_type (Optional[SubModelType]): The submodel type, forwarded to ModelManager.get_model(...).
-
- Returns:
- LoadedModelInfo
- """
- # If the requested model is already installed, return its LoadedModel
- with contextlib.suppress(UnknownModelException):
- # TODO: Replace with wrapper call
- configs = model_manager.store.search_by_attr(
- model_name=model_name, base_model=base_model, model_type=model_type
- )
- loaded_model: LoadedModel = model_manager.load.load_model(configs[0])
- return loaded_model
-
- # Install the requested model.
- job = model_manager.install.heuristic_import(model_path_id_or_url)
- model_manager.install.wait_for_job(job, timeout=10)
- assert job.complete
-
- try:
- loaded_model = model_manager.load.load_model(job.config_out)
- return loaded_model
- except UnknownModelException as e:
- raise Exception(
- "Failed to get model info after installing it. There could be a mismatch between the requested model and"
- f" the installation id ('{model_path_id_or_url}'). Error: {e}"
- )
diff --git a/tests/app/invocations/test_wan_denoise.py b/tests/app/invocations/test_wan_denoise.py
index 6ef348424e..ebd2e1972a 100644
--- a/tests/app/invocations/test_wan_denoise.py
+++ b/tests/app/invocations/test_wan_denoise.py
@@ -10,7 +10,6 @@ runner. End-to-end tests against real Wan checkpoints are gated behind
from __future__ import annotations
import gc
-import os
import weakref
from collections import Counter
from contextlib import contextmanager
@@ -802,17 +801,6 @@ class TestWanDenoiseDualExpert:
assert all(count == 2 for count in Counter(low.timesteps_seen).values())
- os.environ.get("INVOKEAI_HEAVY_TESTS") != "1",
- reason="End-to-end test requires real Wan weights and CUDA; opt in with INVOKEAI_HEAVY_TESTS=1",
-)
-class TestWanDenoiseHeavy:
- """Placeholder for a real-weights smoke test once CUDA is available."""
-
- def test_real_ti2v_5b_runs(self) -> None:
- pytest.skip("Heavy test stub — implement once a TI2V-5B checkpoint is installable.")
-
-
class TestWanDenoiseRefImage:
"""Phase 7: VAE-latent reference-image conditioning for I2V-A14B.
diff --git a/tests/app/invocations/test_wan_ideal_dimensions.py b/tests/app/invocations/test_wan_ideal_dimensions.py
index f5bf5cdda2..5b832b16c6 100644
--- a/tests/app/invocations/test_wan_ideal_dimensions.py
+++ b/tests/app/invocations/test_wan_ideal_dimensions.py
@@ -7,7 +7,6 @@ The node is a pure math transform — no context dependencies — so we can call
import pytest
from invokeai.app.invocations.wan.wan_ideal_dimensions import (
- WAN_TARGET_RESOLUTION_PX,
WanI2VIdealDimensionsInvocation,
)
@@ -102,13 +101,6 @@ class TestPostconditions:
assert oh >= 16
-class TestResolutionPresetTable:
- """The dropdown values must map to the documented short-side pixel counts."""
-
- def test_presets_cover_canonical_video_sizes(self) -> None:
- assert WAN_TARGET_RESOLUTION_PX == {"480p": 480, "720p": 720, "1080p": 1080}
-
-
class TestInputValidation:
"""Reject obviously bad inputs at the schema layer."""
diff --git a/tests/app/invocations/test_wan_ti2v_ideal_dimensions.py b/tests/app/invocations/test_wan_ti2v_ideal_dimensions.py
index 91696a82ca..617a56f2b9 100644
--- a/tests/app/invocations/test_wan_ti2v_ideal_dimensions.py
+++ b/tests/app/invocations/test_wan_ti2v_ideal_dimensions.py
@@ -9,8 +9,6 @@ call ``invoke`` with ``None`` directly.
import pytest
from invokeai.app.invocations.wan.wan_ideal_dimensions import (
- WAN_TARGET_RESOLUTION_PX,
- WAN_TI2V_PIXEL_MULTIPLE,
WanTI2VIdealDimensionsInvocation,
)
@@ -110,16 +108,6 @@ class TestPostconditions:
assert oh >= 32
-class TestResolutionPresetTable:
- """The dropdown values must map to the documented short-side pixel counts."""
-
- def test_presets_cover_canonical_video_sizes(self) -> None:
- assert WAN_TARGET_RESOLUTION_PX == {"480p": 480, "720p": 720, "1080p": 1080}
-
- def test_pixel_multiple_is_32(self) -> None:
- assert WAN_TI2V_PIXEL_MULTIPLE == 32
-
-
class TestInputValidation:
"""Reject obviously bad inputs at the schema layer."""
diff --git a/tests/app/services/auth/test_data_isolation.py b/tests/app/services/auth/test_data_isolation.py
index 848d3d7807..54608fd697 100644
--- a/tests/app/services/auth/test_data_isolation.py
+++ b/tests/app/services/auth/test_data_isolation.py
@@ -128,182 +128,6 @@ class TestBoardDataIsolation:
assert user2_board.board_id in user2_board_ids
assert user1_board.board_id not in user2_board_ids
- def test_user_cannot_access_other_user_board_directly(self, mock_invoker: Invoker):
- """Test that users cannot access other users' boards by ID."""
- board_service = mock_invoker.services.boards
- user_service = mock_invoker.services.users
-
- # Create two users
- user1_data = UserCreateRequest(
- email="[email protected]", display_name="User 1", password="TestPass123", is_admin=False
- )
- user1 = user_service.create(user1_data)
-
- user2_data = UserCreateRequest(
- email="[email protected]", display_name="User 2", password="TestPass123", is_admin=False
- )
- user2 = user_service.create(user2_data)
-
- # User1 creates a board
- user1_board = board_service.create(
- board_name="User 1 Private Board",
- user_id=user1.user_id,
- viewer=BoardViewer(user_id=user1.user_id, is_admin=False),
- )
-
- # User2 tries to access user1's board
- # The get method should check ownership
- try:
- retrieved_board = board_service.get(board_id=user1_board.board_id, user_id=user2.user_id)
- # If get doesn't check ownership, this test needs to be updated
- # or the implementation needs to be fixed
- if retrieved_board is not None:
- # Board was retrieved - check if it's because of missing authorization check
- # This would be a security issue that needs fixing
- pytest.fail("User was able to access another user's board without authorization")
- except Exception:
- # Expected - user2 should not be able to access user1's board
- pass
-
- def test_admin_can_see_all_boards(self, mock_invoker: Invoker):
- """Test that admin users can see all boards."""
- board_service = mock_invoker.services.boards
- user_service = mock_invoker.services.users
-
- # Create admin user
- admin_data = UserCreateRequest(
- email="[email protected]", display_name="Admin", password="AdminPass123", is_admin=True
- )
- admin = user_service.create(admin_data)
-
- # Create regular user
- user_data = UserCreateRequest(
- email="[email protected]", display_name="User", password="TestPass123", is_admin=False
- )
- user = user_service.create(user_data)
-
- # User creates a board
- board_service.create(
- board_name="User Board", user_id=user.user_id, viewer=BoardViewer(user_id=user.user_id, is_admin=False)
- )
-
- # Admin creates a board
- board_service.create(
- board_name="Admin Board", user_id=admin.user_id, viewer=BoardViewer(user_id=admin.user_id, is_admin=True)
- )
-
- # Admin should be able to get all boards (implementation dependent)
- # Note: Current implementation may not have admin override for board listing
- # This test documents expected behavior
-
-
-class TestImageDataIsolation:
- """Tests for image data isolation between users."""
-
- def test_user_images_isolated_from_other_users(self, mock_invoker: Invoker):
- """Test that users cannot see other users' images."""
- user_service = mock_invoker.services.users
-
- # Create two users
- user1_data = UserCreateRequest(
- email="[email protected]", display_name="User 1", password="TestPass123", is_admin=False
- )
- user_service.create(user1_data)
-
- user2_data = UserCreateRequest(
- email="[email protected]", display_name="User 2", password="TestPass123", is_admin=False
- )
- user_service.create(user2_data)
-
- # Note: Image service tests would require actual image creation
- # which is beyond the scope of basic security testing
- # This test documents expected behavior:
- # - Images should have user_id field
- # - Image queries should filter by user_id
- # - Users should not be able to access images by knowing the image_name
-
-
-class TestWorkflowDataIsolation:
- """Tests for workflow data isolation between users."""
-
- def test_user_workflows_isolated_from_other_users(self, mock_invoker: Invoker):
- """Test that users cannot see other users' private workflows."""
- user_service = mock_invoker.services.users
-
- # Create two users
- user1_data = UserCreateRequest(
- email="[email protected]", display_name="User 1", password="TestPass123", is_admin=False
- )
- user_service.create(user1_data)
-
- user2_data = UserCreateRequest(
- email="[email protected]", display_name="User 2", password="TestPass123", is_admin=False
- )
- user_service.create(user2_data)
-
- # Note: Workflow service tests would require workflow creation
- # This test documents expected behavior:
- # - Workflows should have user_id and is_public fields
- # - Private workflows should only be visible to owner
- # - Public workflows should be visible to all users
-
-
-class TestQueueDataIsolation:
- """Tests for session queue data isolation between users."""
-
- def test_user_queue_items_isolated_from_other_users(self, mock_invoker: Invoker):
- """Test that users cannot see other users' queue items."""
- user_service = mock_invoker.services.users
-
- # Create two users
- user1_data = UserCreateRequest(
- email="[email protected]", display_name="User 1", password="TestPass123", is_admin=False
- )
- user_service.create(user1_data)
-
- user2_data = UserCreateRequest(
- email="[email protected]", display_name="User 2", password="TestPass123", is_admin=False
- )
- user_service.create(user2_data)
-
- # Note: Queue service tests would require session creation
- # This test documents expected behavior:
- # - Queue items should have user_id field
- # - Users should only see their own queue items
- # - Admin should see all queue items
-
-
-class TestSharedBoardAccess:
- """Tests for shared board functionality."""
-
- @pytest.mark.skip(reason="Shared board functionality not yet fully implemented")
- def test_shared_board_access(self, mock_invoker: Invoker):
- """Test that users can access boards shared with them."""
- board_service = mock_invoker.services.boards
- user_service = mock_invoker.services.users
-
- # Create two users
- user1_data = UserCreateRequest(
- email="[email protected]", display_name="User 1", password="TestPass123", is_admin=False
- )
- user1 = user_service.create(user1_data)
-
- user2_data = UserCreateRequest(
- email="[email protected]", display_name="User 2", password="TestPass123", is_admin=False
- )
- user_service.create(user2_data)
-
- # User1 creates a board
- board_service.create(
- board_name="Shared Board", user_id=user1.user_id, viewer=BoardViewer(user_id=user1.user_id, is_admin=False)
- )
-
- # User1 shares the board with user2
- # (This functionality is not yet implemented)
-
- # User2 should be able to see the shared board
- # Expected behavior documented for future implementation
-
class TestAdminAuthorization:
"""Tests for admin-only functionality."""
@@ -325,26 +149,6 @@ class TestAdminAuthorization:
)
user_service.create_admin(another_admin_data)
- def test_regular_user_cannot_list_all_users(self, mock_invoker: Invoker):
- """Test that regular users cannot list all users.
-
- Note: This depends on API endpoint implementation.
- At the service level, list_users is available to all callers.
- Authorization should be enforced at the API level.
- """
- user_service = mock_invoker.services.users
-
- # Create users
- user1_data = UserCreateRequest(
- email="[email protected]", display_name="User 1", password="TestPass123", is_admin=False
- )
- user_service.create(user1_data)
-
- # Service level does not enforce authorization
- # API level should check if caller is admin before allowing user listing
- user_service.list_users()
- # This will succeed at service level - API must enforce auth
-
class TestDataIntegrity:
"""Tests for data integrity in multi-user scenarios."""
diff --git a/tests/app/services/auth/test_password_utils.py b/tests/app/services/auth/test_password_utils.py
index 12e5b283ca..4bca4f7ff7 100644
--- a/tests/app/services/auth/test_password_utils.py
+++ b/tests/app/services/auth/test_password_utils.py
@@ -36,16 +36,6 @@ class TestPasswordHashing:
assert verify_password(password, legacy_hash)
assert not verify_password("?" + password[1:], legacy_hash)
- def test_hash_password_returns_different_hash_each_time(self):
- """Test that hashing the same password twice produces different hashes (due to salt)."""
- password = "TestPassword123"
- hash1 = hash_password(password)
- hash2 = hash_password(password)
-
- assert hash1 != hash2
- assert hash1 != password
- assert hash2 != password
-
def test_hash_password_with_special_characters(self):
"""Test hashing passwords with special characters."""
password = "Test!@#$%^&*()_+{}[]|:;<>?,./~`"
diff --git a/tests/app/services/auth/test_security.py b/tests/app/services/auth/test_security.py
index 4864352a01..186bc2b338 100644
--- a/tests/app/services/auth/test_security.py
+++ b/tests/app/services/auth/test_security.py
@@ -423,37 +423,3 @@ class TestInputValidation:
# Cleanup
user_service.delete(user.user_id)
-
-
-class TestRateLimiting:
- """Tests for rate limiting and brute force protection.
-
- Note: Rate limiting is not currently implemented in the codebase.
- These tests document expected behavior for future implementation.
- """
-
- @pytest.mark.skip(reason="Rate limiting not yet implemented")
- def test_login_rate_limiting(self, monkeypatch: Any, mock_invoker: Invoker, client: TestClient):
- """Test that excessive login attempts are rate limited."""
- monkeypatch.setattr("invokeai.app.api.routers.auth.ApiDependencies", MockApiDependencies(mock_invoker))
-
- setup_test_user(mock_invoker, "[email protected]", "TestPass123")
-
- # Try many login attempts with wrong password
- for i in range(20):
- response = client.post(
- "/api/v1/auth/login",
- json={
- "email": "[email protected]",
- "password": "WrongPassword",
- "remember_me": False,
- },
- )
-
- if i < 10:
- # First attempts should return 401
- assert response.status_code == 401
- else:
- # After many attempts, should be rate limited (429)
- # This is expected behavior for future implementation
- pass
diff --git a/tests/app/services/auth/test_token_service.py b/tests/app/services/auth/test_token_service.py
index e79833bd6d..9c9962e142 100644
--- a/tests/app/services/auth/test_token_service.py
+++ b/tests/app/services/auth/test_token_service.py
@@ -251,47 +251,6 @@ class TestTokenExpiration:
assert verified_data is not None
-class TestTokenDataModel:
- """Tests for TokenData model."""
-
- def test_token_data_creation(self):
- """Test creating TokenData instance."""
- token_data = TokenData(
- user_id="user123",
- is_admin=False,
- )
-
- assert token_data.user_id == "user123"
- assert token_data.email == "[email protected]"
- assert token_data.is_admin is False
-
- def test_token_data_with_admin(self):
- """Test TokenData for admin user."""
- token_data = TokenData(
- user_id="admin123",
- is_admin=True,
- )
-
- assert token_data.is_admin is True
-
- def test_token_data_model_dump(self):
- """Test that TokenData can be serialized."""
- token_data = TokenData(
- user_id="user123",
- is_admin=False,
- )
-
- data_dict = token_data.model_dump()
-
- assert isinstance(data_dict, dict)
- assert data_dict["user_id"] == "user123"
- assert data_dict["email"] == "[email protected]"
- assert data_dict["is_admin"] is False
-
-
class TestTokenSecurity:
"""Tests for token security properties."""
diff --git a/tests/app/services/model_load/test_load_api.py b/tests/app/services/model_load/test_load_api.py
index 8f7f844972..f474f8bbf6 100644
--- a/tests/app/services/model_load/test_load_api.py
+++ b/tests/app/services/model_load/test_load_api.py
@@ -2,7 +2,6 @@ from pathlib import Path
import pytest
import torch
-from diffusers import AutoencoderTiny
from invokeai.app.invocations.model import ModelIdentifierField
from invokeai.app.services.invocation_services import InvocationServices
@@ -64,13 +63,6 @@ def test_load_from_path(mock_context: InvocationContext, embedding_file: Path) -
assert torch.equal(loaded_model_1.model["emb_params"], loaded_model_3.model["emb_params"])
[email protected](reason="This requires a test model to load")
-def test_load_from_dir(mock_context: InvocationContext, vae_directory: Path) -> None:
- loaded_model = mock_context.models.load_local_model(vae_directory)
- assert isinstance(loaded_model, LoadedModelWithoutConfig)
- assert isinstance(loaded_model.model, AutoencoderTiny)
-
-
def test_download_and_load(mock_context: InvocationContext) -> None:
loaded_model_1 = mock_context.models.load_remote_model("https://www.test.foo/download/test_embedding.safetensors")
assert isinstance(loaded_model_1, LoadedModelWithoutConfig)
diff --git a/tests/app/services/users/test_password_utils.py b/tests/app/services/users/test_password_utils.py
deleted file mode 100644
index 68fd37db23..0000000000
--- a/tests/app/services/users/test_password_utils.py
+++ /dev/null
@@ -1,56 +0,0 @@
-"""Tests for password utilities."""
-
-from invokeai.app.services.auth.password_utils import hash_password, validate_password_strength, verify_password
-
-
-def test_hash_password():
- """Test password hashing."""
- password = "TestPassword123"
- hashed = hash_password(password)
-
- assert hashed != password
- assert len(hashed) > 0
-
-
-def test_verify_password():
- """Test password verification."""
- password = "TestPassword123"
- hashed = hash_password(password)
-
- assert verify_password(password, hashed)
- assert not verify_password("WrongPassword", hashed)
-
-
-def test_validate_password_strength_valid():
- """Test password strength validation with valid passwords."""
- valid, msg = validate_password_strength("ValidPass123")
- assert valid
- assert msg == ""
-
-
-def test_validate_password_strength_too_short():
- """Test password strength validation with short password."""
- valid, msg = validate_password_strength("Pass1")
- assert not valid
- assert "at least 8 characters" in msg
-
-
-def test_validate_password_strength_no_uppercase():
- """Test password strength validation without uppercase."""
- valid, msg = validate_password_strength("password123")
- assert not valid
- assert "uppercase" in msg.lower()
-
-
-def test_validate_password_strength_no_lowercase():
- """Test password strength validation without lowercase."""
- valid, msg = validate_password_strength("PASSWORD123")
- assert not valid
- assert "lowercase" in msg.lower()
-
-
-def test_validate_password_strength_no_digit():
- """Test password strength validation without digit."""
- valid, msg = validate_password_strength("PasswordTest")
- assert not valid
- assert "number" in msg.lower()
diff --git a/tests/app/services/users/test_token_service.py b/tests/app/services/users/test_token_service.py
deleted file mode 100644
index e9d61bc925..0000000000
--- a/tests/app/services/users/test_token_service.py
+++ /dev/null
@@ -1,50 +0,0 @@
-"""Tests for token service."""
-
-from datetime import timedelta
-
-import pytest
-
-from invokeai.app.services.auth.token_service import TokenData, create_access_token, set_jwt_secret, verify_token
-
-
[email protected](scope="module", autouse=True)
-def setup_jwt_secret() -> None:
- set_jwt_secret("test-secret-key-for-unit-tests-only-do-not-use-in-production")
-
-
-def test_create_access_token():
- """Test creating an access token."""
- data = TokenData(user_id="test-user", email="[email protected]", is_admin=False)
- token = create_access_token(data)
-
- assert token is not None
- assert len(token) > 0
-
-
-def test_verify_valid_token():
- """Test verifying a valid token."""
- data = TokenData(user_id="test-user", email="[email protected]", is_admin=True)
- token = create_access_token(data)
-
- verified_data = verify_token(token)
-
- assert verified_data is not None
- assert verified_data.user_id == data.user_id
- assert verified_data.email == data.email
- assert verified_data.is_admin == data.is_admin
-
-
-def test_verify_invalid_token():
- """Test verifying an invalid token."""
- verified_data = verify_token("invalid-token")
- assert verified_data is None
-
-
-def test_token_with_custom_expiration():
- """Test creating token with custom expiration."""
- data = TokenData(user_id="test-user", email="[email protected]", is_admin=False)
- token = create_access_token(data, expires_delta=timedelta(hours=1))
-
- verified_data = verify_token(token)
- assert verified_data is not None
- assert verified_data.user_id == data.user_id
diff --git a/tests/backend/flux/dype/test_dype.py b/tests/backend/flux/dype/test_dype.py
index c66cc3b72a..c676966d62 100644
--- a/tests/backend/flux/dype/test_dype.py
+++ b/tests/backend/flux/dype/test_dype.py
@@ -23,30 +23,6 @@ from invokeai.backend.flux.dype.rope import rope_dype
from invokeai.backend.flux.extensions.dype_extension import DyPEExtension
-class TestDyPEConfig:
- """Tests for DyPEConfig dataclass."""
-
- def test_default_values(self):
- config = DyPEConfig()
- assert config.enable_dype is True
- assert config.base_resolution == 1024
- assert config.dype_scale == 2.0
- assert config.dype_exponent == 2.0
- assert config.dype_start_sigma == 1.0
-
- def test_custom_values(self):
- config = DyPEConfig(
- enable_dype=False,
- base_resolution=512,
- dype_scale=4.0,
- dype_exponent=3.0,
- dype_start_sigma=0.5,
- )
- assert config.enable_dype is False
- assert config.base_resolution == 512
- assert config.dype_scale == 4.0
-
-
class TestDyPEExtension:
"""Tests for DyPE extension helpers."""
diff --git a/tests/backend/ip_adapter/__init__.py b/tests/backend/ip_adapter/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/backend/ip_adapter/test_ip_adapter.py b/tests/backend/ip_adapter/test_ip_adapter.py
deleted file mode 100644
index 87b696c534..0000000000
--- a/tests/backend/ip_adapter/test_ip_adapter.py
+++ /dev/null
@@ -1,84 +0,0 @@
-import pytest
-import torch
-
-from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelType, SubModelType
-from invokeai.backend.stable_diffusion.diffusion.unet_attention_patcher import UNetAttentionPatcher
-from invokeai.backend.util.test_utils import install_and_load_model
-
-
-def build_dummy_sd15_unet_input(torch_device):
- batch_size = 1
- num_channels = 4
- sizes = (32, 32)
-
- noise = torch.randn((batch_size, num_channels) + sizes).to(torch_device)
- time_step = torch.tensor([10]).to(torch_device)
- encoder_hidden_states = torch.randn((batch_size, 77, 768)).to(torch_device)
-
- return {"sample": noise, "timestep": time_step, "encoder_hidden_states": encoder_hidden_states}
-
-
- "model_params",
- [
- # SD1.5, IPAdapter
- {
- "ip_adapter_model_id": "InvokeAI/ip_adapter_sd15",
- "ip_adapter_model_name": "ip_adapter_sd15",
- "base_model": BaseModelType.StableDiffusion1,
- "unet_model_id": "runwayml/stable-diffusion-v1-5",
- "unet_model_name": "stable-diffusion-v1-5",
- },
- # SD1.5, IPAdapterPlus
- {
- "ip_adapter_model_id": "InvokeAI/ip_adapter_plus_sd15",
- "ip_adapter_model_name": "ip_adapter_plus_sd15",
- "base_model": BaseModelType.StableDiffusion1,
- "unet_model_id": "runwayml/stable-diffusion-v1-5",
- "unet_model_name": "stable-diffusion-v1-5",
- },
- # SD1.5, IPAdapterFull
- {
- "ip_adapter_model_id": "InvokeAI/ip-adapter-full-face_sd15",
- "ip_adapter_model_name": "ip-adapter-full-face_sd15",
- "base_model": BaseModelType.StableDiffusion1,
- "unet_model_id": "runwayml/stable-diffusion-v1-5",
- "unet_model_name": "stable-diffusion-v1-5",
- },
- ],
-)
-def test_ip_adapter_unet_patch(model_params, model_installer, torch_device):
- """Smoke test that IP-Adapter weights can be loaded and used to patch a UNet."""
- ip_adapter_info = install_and_load_model(
- model_installer=model_installer,
- model_path_id_or_url=model_params["ip_adapter_model_id"],
- model_name=model_params["ip_adapter_model_name"],
- base_model=model_params["base_model"],
- model_type=ModelType.IPAdapter,
- )
-
- unet_info = install_and_load_model(
- model_installer=model_installer,
- model_path_id_or_url=model_params["unet_model_id"],
- model_name=model_params["unet_model_name"],
- base_model=model_params["base_model"],
- model_type=ModelType.Main,
- submodel_type=SubModelType.UNet,
- )
-
- dummy_unet_input = build_dummy_sd15_unet_input(torch_device)
-
- with torch.no_grad(), ip_adapter_info as ip_adapter, unet_info as unet:
- ip_adapter.to(torch_device, dtype=torch.float32)
- unet.to(torch_device, dtype=torch.float32)
-
- # ip_embeds shape: (batch_size, num_ip_images, seq_len, ip_image_embedding_len)
- ip_embeds = torch.randn((1, 3, 4, 768)).to(torch_device)
-
- cross_attention_kwargs = {"ip_adapter_image_prompt_embeds": [ip_embeds]}
- ip_adapter_unet_patcher = UNetAttentionPatcher([ip_adapter])
- with ip_adapter_unet_patcher.apply_ip_adapter_attention(unet):
- output = unet(**dummy_unet_input, cross_attention_kwargs=cross_attention_kwargs).sample
-
- assert output.shape == dummy_unet_input["sample"].shape
diff --git a/tests/backend/model_manager/model_manager_fixtures.py b/tests/backend/model_manager/model_manager_fixtures.py
index 00a748d172..ceec9b453f 100644
--- a/tests/backend/model_manager/model_manager_fixtures.py
+++ b/tests/backend/model_manager/model_manager_fixtures.py
@@ -67,13 +67,6 @@ def embedding_file(mm2_model_files: Path) -> Path:
return mm2_model_files / "test_embedding.safetensors"
-# Can be used to test diffusers model directory loading, but
-# the test file adds ~10MB of space.
-# @pytest.fixture
-# def vae_directory(mm2_model_files: Path) -> Path:
-# return mm2_model_files / "taesdxl"
-
-
@pytest.fixture
def diffusers_dir(mm2_model_files: Path) -> Path:
return mm2_model_files / "test-diffusers-main"
diff --git a/tests/backend/quantization/gguf/test_loaders.py b/tests/backend/quantization/gguf/test_loaders.py
index 38ba5c4847..6d60d211d6 100644
--- a/tests/backend/quantization/gguf/test_loaders.py
+++ b/tests/backend/quantization/gguf/test_loaders.py
@@ -1,3 +1,5 @@
+import gc
+import weakref
from collections.abc import Sequence
import gguf
@@ -472,3 +474,45 @@ def test_unpacking_a_quantized_tensor_reserves_one_slice_of_temporaries_not_the_
result = 37 * 512 * torch.bfloat16.itemsize
assert reserved == [result + packed + HOST_DEQUANT_PEAK_COPIES * 3 * 512 * torch.bfloat16.itemsize]
+
+
+def _tensor_names_through_reader(path):
+ # A function of its own: like the callers of `WrappedGGUFReader`, the name `reader` ends when it returns.
+ with WrappedGGUFReader(path) as reader:
+ return [tensor.name for tensor in reader.tensors]
+
+
[email protected]("probe", ["header_read", "metadata", "state_dict", "reader"])
+def test_a_probed_gguf_is_free_to_delete_at_once(tmp_path, monkeypatch, probe):
+ """Installing a model deletes or moves the file right after identification, and Windows refuses that while
+ it is still mapped. The map must be released by reference count, not by a later collection.
+
+ The map's death is asserted directly as well, since POSIX renames and deletes a mapped file without complaint."""
+ path = tmp_path / "model.gguf"
+ write_gguf(path, {"proj.weight": torch.ones(4, 32)}, metadata={"general.name": "probe"})
+
+ maps: list[weakref.ref] = []
+ original_init = gguf.GGUFReader.__init__
+
+ def init_and_track_the_map(self, *args, **kwargs):
+ original_init(self, *args, **kwargs)
+ maps.append(weakref.ref(self.data))
+
+ monkeypatch.setattr(gguf.GGUFReader, "__init__", init_and_track_the_map)
+
+ gc.disable()
+ try:
+ if probe == "header_read":
+ gguf_header_state_dict(path, compute_dtype=torch.float32)
+ elif probe == "metadata":
+ assert ModelOnDisk(path).metadata()["general.name"] == "probe"
+ elif probe == "state_dict":
+ assert "proj.weight" in ModelOnDisk(path).load_state_dict()
+ else:
+ _tensor_names_through_reader(path)
+ assert maps
+ assert all(ref() is None for ref in maps)
+ path.rename(tmp_path / "moved.gguf")
+ (tmp_path / "moved.gguf").unlink()
+ finally:
+ gc.enable()
diff --git a/tests/backend/test_text_llm_pipeline.py b/tests/backend/test_text_llm_pipeline.py
deleted file mode 100644
index dffa83d360..0000000000
--- a/tests/backend/test_text_llm_pipeline.py
+++ /dev/null
@@ -1,86 +0,0 @@
-"""Regression test for TextLLMPipeline's system-role fallback.
-
-Some chat templates (notably Gemma) reject a dedicated "system" role and raise
-"System role not supported". The pipeline should fold the system prompt into the user
-turn and retry instead of failing prompt expansion.
-"""
-
-from unittest.mock import MagicMock
-
-import pytest
-import torch
-
-from invokeai.backend import text_llm_pipeline
-from invokeai.backend.text_llm_pipeline import TextLLMPipeline
-
-
[email protected](autouse=True)
-def _short_stream_timeout(monkeypatch: pytest.MonkeyPatch) -> None:
- """Fail fast instead of blocking for the production timeout if a fake stops streaming."""
- monkeypatch.setattr(text_llm_pipeline, "STREAM_TIMEOUT", 5.0)
-
-
-class _FakeEncoding(dict):
- def to(self, *args, **kwargs):
- return self
-
-
-def _make_tokenizer(*, rejects_system_role: bool) -> MagicMock:
- tokenizer = MagicMock()
- tokenizer.chat_template = "<<template>>"
-
- def apply_chat_template(messages, **kwargs):
- if rejects_system_role and any(m["role"] == "system" for m in messages):
- raise ValueError("System role not supported")
- return "FORMATTED_PROMPT"
-
- tokenizer.apply_chat_template.side_effect = apply_chat_template
- tokenizer.return_value = _FakeEncoding(
- input_ids=torch.tensor([[1, 2, 3]]), attention_mask=torch.tensor([[1, 1, 1]])
- )
- tokenizer.decode.return_value = " expanded prompt "
- return tokenizer
-
-
-def _make_model() -> MagicMock:
- """A model whose generate() feeds the streamer the way transformers does."""
- model = MagicMock()
-
- def generate(**kwargs):
- streamer = kwargs["streamer"]
- # transformers pushes the prompt first (dropped by skip_prompt), then the new tokens.
- streamer.put(torch.tensor([[1, 2, 3]]))
- streamer.put(torch.tensor([4, 5]))
- streamer.end()
- return torch.tensor([[1, 2, 3, 4, 5]])
-
- model.generate.side_effect = generate
- return model
-
-
-def test_system_role_is_folded_into_user_turn_when_unsupported() -> None:
- tokenizer = _make_tokenizer(rejects_system_role=True)
- pipeline = TextLLMPipeline(_make_model(), tokenizer)
-
- result = pipeline.run("a cat", system_prompt="be helpful", max_new_tokens=8)
-
- assert result == "expanded prompt"
- # Two attempts: the first with a system role (rejected), the retry with a merged user turn.
- assert tokenizer.apply_chat_template.call_count == 2
- retry_messages = tokenizer.apply_chat_template.call_args_list[1].args[0]
- assert all(m["role"] != "system" for m in retry_messages)
- assert "be helpful" in retry_messages[0]["content"]
- assert "a cat" in retry_messages[0]["content"]
-
-
-def test_system_role_is_used_directly_when_supported() -> None:
- tokenizer = _make_tokenizer(rejects_system_role=False)
- pipeline = TextLLMPipeline(_make_model(), tokenizer)
-
- result = pipeline.run("a cat", system_prompt="be helpful", max_new_tokens=8)
-
- assert result == "expanded prompt"
- # No retry needed: the system role is applied on the first attempt.
- assert tokenizer.apply_chat_template.call_count == 1
- first_messages = tokenizer.apply_chat_template.call_args_list[0].args[0]
- assert first_messages[0]["role"] == "system"
diff --git a/tests/backend/text_llm/test_text_llm_pipeline.py b/tests/backend/text_llm/test_text_llm_pipeline.py
index d4cca735b7..207d96185f 100644
--- a/tests/backend/text_llm/test_text_llm_pipeline.py
+++ b/tests/backend/text_llm/test_text_llm_pipeline.py
@@ -23,7 +23,6 @@ from invokeai.backend import text_llm_pipeline
from invokeai.backend.model_manager.taxonomy import SubModelType
from invokeai.backend.qwen3_5.qwen3_5_vl import build_qwen3_5_vl_processor
from invokeai.backend.text_llm_pipeline import (
- DEFAULT_SYSTEM_PROMPT,
TextLLMPipeline,
_SeededMultinomialMode,
load_text_llm_tokenizer_and_processor,
@@ -144,6 +143,29 @@ def test_pipeline_uses_chat_template_when_available():
assert any(m["role"] == "user" and m["content"] == "a cat" for m in messages)
+def test_system_role_is_folded_into_user_turn_when_the_template_rejects_it():
+ """Some chat templates (notably Gemma) raise "System role not supported"; the pipeline retries with the
+ system prompt folded into the user turn instead of failing prompt expansion."""
+ tokenizer = _make_mock_tokenizer(has_chat_template=True)
+
+ def apply_chat_template(messages, **kwargs):
+ if any(m["role"] == "system" for m in messages):
+ raise ValueError("System role not supported")
+ return "FORMATTED_PROMPT"
+
+ tokenizer.apply_chat_template.side_effect = apply_chat_template
+ pipeline = TextLLMPipeline(_make_mock_model(), tokenizer)
+
+ with _patch_streamer():
+ pipeline.run(prompt="a cat", system_prompt="be helpful", device=torch.device("cpu"), dtype=torch.float32)
+
+ assert tokenizer.apply_chat_template.call_count == 2
+ retry_messages = tokenizer.apply_chat_template.call_args_list[1].args[0]
+ assert all(m["role"] != "system" for m in retry_messages)
+ assert "be helpful" in retry_messages[0]["content"]
+ assert "a cat" in retry_messages[0]["content"]
+
+
def test_pipeline_fallback_without_chat_template():
"""Pipeline should use fallback formatting when no chat template exists."""
tokenizer = _make_mock_tokenizer(has_chat_template=False)
@@ -497,12 +519,6 @@ def test_pipeline_reraises_generation_error_without_hanging():
assert "CUDA out of memory" in str(result[0])
-def test_default_system_prompt_content():
- """The default system prompt should mention image generation."""
- assert "image generation" in DEFAULT_SYSTEM_PROMPT.lower()
- assert "prompt" in DEFAULT_SYSTEM_PROMPT.lower()
-
-
def test_pipeline_conditions_on_an_image_through_the_processor():
"""The image goes to the processor next to the rendered template, and its pixels reach generate() in
the model's dtype while the token ids stay integral."""
diff --git a/tests/backend/working_memory/test_fit.py b/tests/backend/working_memory/test_fit.py
index 6b66bdc465..7aa29764b0 100644
--- a/tests/backend/working_memory/test_fit.py
+++ b/tests/backend/working_memory/test_fit.py
@@ -208,10 +208,6 @@ def test_no_assembly_line_passes_through_a_point_its_floor_covers() -> None:
assert two_phase_envelope([*decodes, covered]) == ((Fraction(125, 4), 0), (0, 0))
-def test_the_shipped_margin_is_five_percent() -> None:
- assert SHIPPED_MARGIN == Fraction(5, 100)
-
-
def test_the_shipped_pair_adds_the_margin_and_rounds_up() -> None:
k, b = upper_envelope(SCATTERED)
shipped_k, shipped_b = shipped_pair(SCATTERED)
diff --git a/tests/conftest.py b/tests/conftest.py
index a7abf14c41..a175a77fb7 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,9 +1,5 @@
# conftest.py is a special pytest file. Fixtures defined in this file will be accessible to all tests in this directory
# without needing to explicitly import them. (https://docs.pytest.org/en/6.2.x/fixture.html)
-
-
-# We import the model_installer and torch_device fixtures here so that they can be used by all tests. Flake8 does not
-# play well with fixtures (F401 and F811), so this is cleaner than importing in all files that use these fixtures.
import logging
import os
import shutil
diff --git a/tests/dev_prompts.txt b/tests/dev_prompts.txt
deleted file mode 100644
index 9ebca4e9f7..0000000000
--- a/tests/dev_prompts.txt
+++ /dev/null
@@ -1 +0,0 @@
-banana sushi -Ak_lms -S42
diff --git a/tests/inpainting/coyote-inpainting.prompt b/tests/inpainting/coyote-inpainting.prompt
deleted file mode 100644
index 7f979c55e7..0000000000
--- a/tests/inpainting/coyote-inpainting.prompt
+++ /dev/null
@@ -1,14 +0,0 @@
-# 🌻 🌻 🌻 sunflowers 🌻 🌻 🌻
-a coyote, deep palette knife oil painting, sunflowers, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.2
-a coyote, deep palette knife oil painting, sunflowers, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.4
-a coyote, deep palette knife oil painting, sunflowers, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.6
-a coyote, deep palette knife oil painting, sunflowers, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.8
-a coyote, deep palette knife oil painting, sunflowers, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.99
-
-# 🌹 🌹 🌹 roses 🌹 🌹 🌹
-a coyote, deep palette knife oil painting, red roses, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.2
-a coyote, deep palette knife oil painting, red roses, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.4
-a coyote, deep palette knife oil painting, red roses, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.6
-a coyote, deep palette knife oil painting, red roses, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.8
-a coyote, deep palette knife oil painting, red roses, plants, desert landscape, award winning -s 50 -S 1234554321 -W 512 -H 512 -C 7.5 -I tests/inpainting/coyote-input.webp -A k_lms -M tests/inpainting/coyote-mask.webp -f 0.99
-
diff --git a/tests/inpainting/coyote-input.webp b/tests/inpainting/coyote-input.webp
deleted file mode 100644
index 488caceae5..0000000000
Binary files a/tests/inpainting/coyote-input.webp and /dev/null differ
diff --git a/tests/inpainting/coyote-mask.webp b/tests/inpainting/coyote-mask.webp
deleted file mode 100644
index 1716bd5f18..0000000000
Binary files a/tests/inpainting/coyote-mask.webp and /dev/null differ
diff --git a/tests/inpainting/original.json b/tests/inpainting/original.json
deleted file mode 100644
index 1a9320da03..0000000000
--- a/tests/inpainting/original.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "model": "stable diffusion",
- "model_id": null,
- "model_hash": "cc6cb27103417325ff94f52b7a5d2dde45a7515b25c255d8e396c90014281516",
- "app_id": "invoke-ai/InvokeAI",
- "app_version": "v2.2.3",
- "image": {
- "height": 512,
- "steps": 50,
- "facetool": "gfpgan",
- "facetool_strength": 0,
- "seed": 1948097268,
- "perlin": 0,
- "init_mask": null,
- "width": 512,
- "upscale": null,
- "cfg_scale": 7.5,
- "prompt": [
- {
- "prompt": "a coyote, deep palette knife oil painting, red aloe, plants, desert landscape, award winning",
- "weight": 1
- }
- ],
- "threshold": 0,
- "postprocessing": null,
- "sampler": "lms",
- "variations": [],
- "type": "txt2img"
- }
-}
diff --git a/tests/legacy_tests.sh b/tests/legacy_tests.sh
deleted file mode 100755
index a171a47c2b..0000000000
--- a/tests/legacy_tests.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /usr/bin/env bash
-
-# This file contains bunch of compatibility tests that ensures
-# that the API interface of `scripts/legacy-api.py` remains stable
-
-set -e
-
-OUTDIR=$(mktemp -d)
-
-echo "Using directory $OUTDIR"
-
-# Start API
-python -u scripts/legacy_api.py --web --host=localhost --port=3333 --outdir=$OUTDIR &> $OUTDIR/sd.log &
-APP_PID=$!
-
-echo "Wait for server to startup"
-
-tail -f -n0 $OUTDIR/sd.log | grep -qe "Point your browser at"
-
-echo "Started, continuing"
-
-if [ $? == 1 ]; then
- echo "Search terminated without finding the pattern"
-fi
-
-# Generate image
-RESULT=$(curl -v -X POST -d '{"index":0,"variation_amount":0,"with_variations":"","steps":25,"width":512,"seed":"1337","prompt":"A cat wearing a hat","strength":0.5,"initimg":null,"cfg_scale":2,"iterations":1,"upscale_level":0,"upscale_strength":0,"sampler_name":"k_euler","height":512}' localhost:3333 | grep result)
-
-# Test 01 - Image contents
-FILENAME=$(echo $RESULT | jq -r .url)
-
-ACTUAL_CHECKSUM=$(sha256sum $FILENAME)
-EXPECTED_CHECKSUM="a77799226a4dfc62a1674498e575c775da042959a4b90b13e26f666c302f079f"
-
-if [ "$ACTUAL_CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
- echo "Expected hash $EXPECTED_CHECKSUM but got hash $ACTUAL_CHECKSUM"
- kill $APP_PID
- # rm -r $OUTDIR
- exit 33
-fi
-
-# Assert output
-
-# Cleanup
-kill $APP_PID
-# rm -r $OUTDIR
diff --git a/tests/test_graph_execution_state.py b/tests/test_graph_execution_state.py
index c06dea1c18..e30338ad04 100644
--- a/tests/test_graph_execution_state.py
+++ b/tests/test_graph_execution_state.py
@@ -5261,72 +5261,6 @@ def test_if_output_iterates_selected_collection_with_eager_branch_producers(
assert unselected_node_id in executed_node_ids
[email protected](strict=True, reason="Legacy eager If-node execution should no longer occur")
-def test_if_graph_current_behavior_executes_both_branches_and_shared_ancestors():
- graph = Graph()
- graph.add_node(BooleanInvocation(id="condition", value=True))
- graph.add_node(PromptTestInvocation(id="shared", prompt="shared value"))
- graph.add_node(PromptTestInvocation(id="true_mid"))
- graph.add_node(PromptTestInvocation(id="true_leaf"))
- graph.add_node(PromptTestInvocation(id="false_mid"))
- graph.add_node(PromptTestInvocation(id="false_leaf"))
- graph.add_node(PromptTestInvocation(id="side_consumer"))
- graph.add_node(IfInvocation(id="if"))
- graph.add_node(PromptTestInvocation(id="selected_output"))
-
- graph.add_edge(create_edge("condition", "value", "if", "condition"))
- graph.add_edge(create_edge("shared", "prompt", "true_mid", "prompt"))
- graph.add_edge(create_edge("true_mid", "prompt", "true_leaf", "prompt"))
- graph.add_edge(create_edge("true_leaf", "prompt", "if", "true_input"))
- graph.add_edge(create_edge("shared", "prompt", "false_mid", "prompt"))
- graph.add_edge(create_edge("false_mid", "prompt", "false_leaf", "prompt"))
- graph.add_edge(create_edge("false_leaf", "prompt", "if", "false_input"))
- graph.add_edge(create_edge("shared", "prompt", "side_consumer", "prompt"))
- graph.add_edge(create_edge("if", "value", "selected_output", "prompt"))
-
- g = GraphExecutionState(graph=graph)
- executed_source_ids = execute_all_nodes(g)
-
- assert set(executed_source_ids) == {
- "condition",
- "shared",
- "true_mid",
- "true_leaf",
- "false_mid",
- "false_leaf",
- "side_consumer",
- "if",
- "selected_output",
- }
- assert executed_source_ids.count("false_mid") == 1
- assert executed_source_ids.count("false_leaf") == 1
-
- prepared_selected_output_id = next(iter(g.source_prepared_mapping["selected_output"]))
- assert g.results[prepared_selected_output_id].prompt == "shared value"
-
-
[email protected](strict=True, reason="Legacy eager If-node execution should no longer occur")
-def test_if_graph_current_behavior_executes_both_simple_branches():
- graph = Graph()
- graph.add_node(BooleanInvocation(id="condition", value=True))
- graph.add_node(PromptTestInvocation(id="true_value", prompt="true branch"))
- graph.add_node(PromptTestInvocation(id="false_value", prompt="false branch"))
- graph.add_node(IfInvocation(id="if"))
- graph.add_node(PromptTestInvocation(id="selected_output"))
-
- graph.add_edge(create_edge("condition", "value", "if", "condition"))
- graph.add_edge(create_edge("true_value", "prompt", "if", "true_input"))
- graph.add_edge(create_edge("false_value", "prompt", "if", "false_input"))
- graph.add_edge(create_edge("if", "value", "selected_output", "prompt"))
-
- g = GraphExecutionState(graph=graph)
- executed_source_ids = execute_all_nodes(g)
-
- assert set(executed_source_ids) == {"condition", "true_value", "false_value", "if", "selected_output"}
- prepared_selected_output_id = next(iter(g.source_prepared_mapping["selected_output"]))
- assert g.results[prepared_selected_output_id].prompt == "true branch"
-
-
def test_if_graph_optimized_behavior_executes_only_selected_simple_branch_and_records_history():
graph = Graph()
graph.add_node(BooleanInvocation(id="condition", value=True))
diff --git a/tests/test_model_manager/configs/relative_sub.models.yaml b/tests/test_model_manager/configs/relative_sub.models.yaml
deleted file mode 100644
index 2e26710d13..0000000000
--- a/tests/test_model_manager/configs/relative_sub.models.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-__metadata__:
- version: 3.0.0
-
-sdxl/main/SDXL base:
- path: sdxl/main/SDXL base 1_0
- description: SDXL base v1.0
- variant: normal
- format: diffusers
-
-sdxl/main/SDXL with VAE:
- path: sdxl/main/SDXL base 1_0
- description: SDXL with customized VAE
- vae: sdxl/vae/sdxl-vae-fp16-fix/
- variant: normal
- format: diffusers
-
-sdxl/main/SDXL with empty VAE:
- path: sdxl/main/SDXL base 1_0
- description: SDXL with customized VAE
- vae: ''
- variant: normal
- format: diffusers
diff --git a/tests/test_model_manager/models/sdxl/main/SDXL base 1_0/model_index.json b/tests/test_model_manager/models/sdxl/main/SDXL base 1_0/model_index.json
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/test_model_manager/models/sdxl/vae/sdxl-vae-fp16-fix/config.json b/tests/test_model_manager/models/sdxl/vae/sdxl-vae-fp16-fix/config.json
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/validate_pr_prompt.txt b/tests/validate_pr_prompt.txt
deleted file mode 100644
index 8607987864..0000000000
--- a/tests/validate_pr_prompt.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-t2i --positive_prompt 'banana sushi' --seed 42
-compel --prompt 'strawberry sushi' | compel | noise | t2l --scheduler heun --steps 3 --scheduler ddim --link -3 conditioning positive_conditioning --link -2 conditioning negative_conditioning | l2i
-compel --prompt 'banana sushi' | compel | noise | t2l --scheduler heun --steps 3 --scheduler euler_a --link -3 conditioning positive_conditioning --link -2 conditioning negative_conditioning