generated from john/python-template
fixture updates
This commit is contained in:
@@ -17,6 +17,9 @@ from transcription.db.operations import create_all
|
|||||||
from transcription.db.runtime import dispose_database_runtime
|
from transcription.db.runtime import dispose_database_runtime
|
||||||
from transcription.db.runtime import get_engine
|
from transcription.db.runtime import get_engine
|
||||||
from transcription.db.runtime import get_session
|
from transcription.db.runtime import get_session
|
||||||
|
from transcription.db.runtime import get_session_factory
|
||||||
|
from transcription.services.documents import DocumentService
|
||||||
|
from transcription.services.jobs import JobService
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -47,3 +50,22 @@ async def async_session(default_settings: Settings):
|
|||||||
yield async_session
|
yield async_session
|
||||||
|
|
||||||
await dispose_database_runtime()
|
await dispose_database_runtime()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def default_session_factory(default_settings: Settings):
|
||||||
|
"""Provide a base fixture for tests that require database access."""
|
||||||
|
session_factory = get_session_factory(settings=default_settings)
|
||||||
|
return session_factory
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def job_service(default_session_factory) -> JobService:
|
||||||
|
"""Provide a JobService instance for testing."""
|
||||||
|
return JobService(session_factory=default_session_factory)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def document_service(default_session_factory) -> DocumentService:
|
||||||
|
"""Provide a DocumentService instance for testing."""
|
||||||
|
return DocumentService(session_factory=default_session_factory)
|
||||||
|
|||||||
Reference in New Issue
Block a user