249c5de76a
- Refactor memory system (episodic/STM/LTM with components) - Implement complete subtitle domain (scanner, matcher, placer) - Add YAML workflow infrastructure - Externalize knowledge base (patterns, release groups) - Add comprehensive testing suite - Create manual testing CLIs
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Fixtures for application-layer tests."""
|
|
|
|
import shutil
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from alfred.infrastructure.persistence import Memory, set_memory
|
|
|
|
|
|
@pytest.fixture
|
|
def app_temp(tmp_path):
|
|
"""Real folder structure: downloads, movies, tv_shows, torrents."""
|
|
(tmp_path / "downloads").mkdir()
|
|
(tmp_path / "movies").mkdir()
|
|
(tmp_path / "tv_shows").mkdir()
|
|
(tmp_path / "torrents").mkdir()
|
|
return tmp_path
|
|
|
|
|
|
@pytest.fixture
|
|
def memory_configured(app_temp, tmp_path):
|
|
"""
|
|
Fresh Memory with library_paths and workspace configured using the real API.
|
|
Replaces the broken memory_with_config from root conftest for these tests.
|
|
"""
|
|
import tempfile, os
|
|
storage = tempfile.mkdtemp()
|
|
mem = Memory(storage_dir=storage)
|
|
set_memory(mem)
|
|
|
|
mem.ltm.workspace.download = str(app_temp / "downloads")
|
|
mem.ltm.workspace.torrent = str(app_temp / "torrents")
|
|
mem.ltm.library_paths.set("movie", str(app_temp / "movies"))
|
|
mem.ltm.library_paths.set("tv_show", str(app_temp / "tv_shows"))
|
|
mem.save()
|
|
|
|
yield mem
|
|
|
|
shutil.rmtree(storage, ignore_errors=True)
|