Migrate from Poetry and pyenv to uv
This commit is contained in:
+14
-7
@@ -1,4 +1,5 @@
|
||||
"""Tests for pool → TMDb migration (src.core.migrate + FileManager)."""
|
||||
|
||||
import pytest
|
||||
|
||||
from src.core.migrate import classify, normalize
|
||||
@@ -49,9 +50,11 @@ class TestFileManagerMigrate:
|
||||
@pytest.fixture
|
||||
def file_manager(self, tmp_path, monkeypatch):
|
||||
import src.core.config as config_module
|
||||
|
||||
monkeypatch.setattr(config_module, "GLOBAL_CONFIG_FILE", tmp_path / ".gtag")
|
||||
from src.core.tag_manager import TagManager
|
||||
from src.core.file_manager import FileManager
|
||||
from src.core.tag_manager import TagManager
|
||||
|
||||
fm = FileManager(TagManager())
|
||||
fm.set_pool_dir(tmp_path / "pool")
|
||||
return fm
|
||||
@@ -61,10 +64,13 @@ class TestFileManagerMigrate:
|
||||
movie = file_manager.import_movie(tmp_path / "a.mkv", "Matrix", year=1999)
|
||||
assert "[tmdbid" not in movie.file_path.name # not migrated yet
|
||||
|
||||
import src.core.tmdb as tmdb
|
||||
from src.core import tmdb
|
||||
|
||||
monkeypatch.setattr(
|
||||
tmdb, "search_movie",
|
||||
lambda q, year=None, limit=5: [TmdbResult(603, "Matrix", "1999", "movie")])
|
||||
tmdb,
|
||||
"search_movie",
|
||||
lambda q, year=None, limit=5: [TmdbResult(603, "Matrix", "1999", "movie")],
|
||||
)
|
||||
|
||||
proposals = file_manager.match_pool_to_tmdb()
|
||||
assert len(proposals) == 1
|
||||
@@ -78,11 +84,12 @@ class TestFileManagerMigrate:
|
||||
(tmp_path / "a.mkv").write_bytes(b"x")
|
||||
file_manager.import_movie(tmp_path / "a.mkv", "Matrix", year=1999, tmdb_id=603)
|
||||
|
||||
import src.core.tmdb as tmdb
|
||||
from src.core import tmdb
|
||||
|
||||
called = []
|
||||
monkeypatch.setattr(
|
||||
tmdb, "search_movie",
|
||||
lambda q, year=None, limit=5: called.append(q) or [])
|
||||
tmdb, "search_movie", lambda q, year=None, limit=5: called.append(q) or []
|
||||
)
|
||||
proposals = file_manager.match_pool_to_tmdb()
|
||||
assert proposals == [] and called == [] # already has id → not searched
|
||||
|
||||
|
||||
Reference in New Issue
Block a user