relocating event_service fixture due to import ordering

This commit is contained in:
Stefan Tobler 2024-02-16 22:49:38 -05:00 committed by psychedelicious
parent b5a9ed351d
commit 0ab9fe6987
3 changed files with 6 additions and 8 deletions

View File

@ -46,6 +46,12 @@ def mock_image_dto() -> ImageDTO:
)
@pytest.fixture
def mock_event_service() -> DummyEventService:
"""Create a dummy event service."""
return DummyEventService()
@pytest.fixture
def mock_services(mock_event_service: DummyEventService) -> InvocationServices:
configuration = InvokeAIAppConfig(use_memory_db=True, node_cache_size=0)

View File

@ -5,4 +5,3 @@
# 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.
from invokeai.backend.util.test_utils import torch_device # noqa: F401
from tests.fixtures.event_service import mock_event_service # noqa: F401

View File

@ -1,6 +1,5 @@
from typing import Any, Dict, List
import pytest
from pydantic import BaseModel
from invokeai.app.services.events.events_base import EventServiceBase
@ -26,9 +25,3 @@ class DummyEventService(EventServiceBase):
def dispatch(self, event_name: str, payload: Any) -> None:
"""Dispatch an event by appending it to self.events."""
self.events.append(DummyEvent(event_name=payload["event"], payload=payload["data"]))
@pytest.fixture
def mock_event_service() -> DummyEventService:
"""Create a dummy event service."""
return DummyEventService()