fix: use @pytest_asyncio.fixture for async fixtures in test_engine.py
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
import pytest_asyncio
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -6,7 +7,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from app.models import Source, Job, JobExecution
|
from app.models import Source, Job, JobExecution
|
||||||
from backup.engine import BackupEngine
|
from backup.engine import BackupEngine
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest_asyncio.fixture
|
||||||
async def test_source(db: AsyncSession):
|
async def test_source(db: AsyncSession):
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
# Create test files
|
# Create test files
|
||||||
@@ -24,7 +25,7 @@ async def test_source(db: AsyncSession):
|
|||||||
await db.refresh(source)
|
await db.refresh(source)
|
||||||
yield source
|
yield source
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest_asyncio.fixture
|
||||||
async def test_job(db: AsyncSession, test_source):
|
async def test_job(db: AsyncSession, test_source):
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
job = Job(
|
job = Job(
|
||||||
|
|||||||
Reference in New Issue
Block a user