31 lines
662 B
Python
31 lines
662 B
Python
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
BACKEND_DIR = Path(__file__).resolve().parents[1]
|
|
if str(BACKEND_DIR) not in sys.path:
|
|
sys.path.insert(0, str(BACKEND_DIR))
|
|
|
|
|
|
@pytest.fixture()
|
|
def isolated_db(tmp_path, monkeypatch):
|
|
from app import db as db_module
|
|
|
|
monkeypatch.setattr(db_module, "DB_PATH", tmp_path / "app.db")
|
|
from app.migrations import run_migrations
|
|
|
|
run_migrations()
|
|
return tmp_path / "app.db"
|
|
|
|
|
|
@pytest.fixture()
|
|
def no_notifications(monkeypatch):
|
|
async def noop(*args, **kwargs):
|
|
return None
|
|
|
|
import app.backup_service as backup_service
|
|
|
|
monkeypatch.setattr(backup_service, "notify", noop)
|