feat: major architectural refactor
- 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
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""Fixtures for infrastructure-layer tests."""
|
||||
|
||||
import shutil
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from alfred.infrastructure.persistence import Memory, set_memory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def infra_temp(tmp_path):
|
||||
"""Real folder layout: downloads (with files), movies, tv_shows, torrents."""
|
||||
dl = tmp_path / "downloads"
|
||||
dl.mkdir()
|
||||
(dl / "test_movie.mkv").write_bytes(b"fake video")
|
||||
series_dir = dl / "test_series"
|
||||
series_dir.mkdir()
|
||||
(series_dir / "episode1.mkv").write_bytes(b"fake episode")
|
||||
|
||||
(tmp_path / "movies").mkdir()
|
||||
(tmp_path / "tv_shows").mkdir()
|
||||
(tmp_path / "torrents").mkdir()
|
||||
return tmp_path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def memory_configured(infra_temp):
|
||||
"""Fresh Memory configured with the real workspace/library_paths API."""
|
||||
storage = tempfile.mkdtemp()
|
||||
mem = Memory(storage_dir=storage)
|
||||
set_memory(mem)
|
||||
|
||||
mem.ltm.workspace.download = str(infra_temp / "downloads")
|
||||
mem.ltm.workspace.torrent = str(infra_temp / "torrents")
|
||||
mem.ltm.library_paths.set("movie", str(infra_temp / "movies"))
|
||||
mem.ltm.library_paths.set("tv_show", str(infra_temp / "tv_shows"))
|
||||
mem.save()
|
||||
|
||||
yield mem
|
||||
|
||||
shutil.rmtree(storage, ignore_errors=True)
|
||||
Reference in New Issue
Block a user