Migrate from Poetry and pyenv to uv

This commit is contained in:
2026-10-12 15:48:26 +02:00
parent c399a6aed3
commit c69f5f9166
93 changed files with 13068 additions and 2401 deletions
+26 -10
View File
@@ -1,4 +1,5 @@
"""Tests for the NFO reader (src.core.nfo)."""
from src.core.nfo import NfoData, find_nfo, read_nfo
MOVIE_NFO = """<?xml version="1.0" encoding="utf-8"?>
@@ -26,14 +27,20 @@ def test_read_nfo_sibling(tmp_path):
nfo = read_nfo(video)
assert nfo == NfoData(
title="Matrix", year="1999", genres=["Akční", "Sci-Fi"],
countries=["USA"], rating=87, tmdb_id=603)
title="Matrix",
year="1999",
genres=["Akční", "Sci-Fi"],
countries=["USA"],
rating=87,
tmdb_id=603,
)
def test_rating_scaled_to_percent(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
"<movie><rating>7.3</rating></movie>", encoding="utf-8")
"<movie><rating>7.3</rating></movie>", encoding="utf-8"
)
assert read_nfo(video).rating == 73
@@ -41,21 +48,25 @@ def test_rating_from_ratings_block(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
"<movie><ratings><rating name='tmdb'><value>9.1</value></rating>"
"</ratings></movie>", encoding="utf-8")
"</ratings></movie>",
encoding="utf-8",
)
assert read_nfo(video).rating == 91
def test_tmdbid_from_tmdbid_tag(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
"<movie><tmdbid>603</tmdbid></movie>", encoding="utf-8")
"<movie><tmdbid>603</tmdbid></movie>", encoding="utf-8"
)
assert read_nfo(video).tmdb_id == 603
def test_csfd_url_from_uniqueid_bare_id(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
'<movie><uniqueid type="csfd">9499</uniqueid></movie>', encoding="utf-8")
'<movie><uniqueid type="csfd">9499</uniqueid></movie>', encoding="utf-8"
)
assert read_nfo(video).csfd_url == "https://www.csfd.cz/film/9499/"
@@ -63,21 +74,25 @@ def test_csfd_url_from_uniqueid_full_url(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
'<movie><uniqueid type="csfd">https://www.csfd.cz/film/9499-matrix/'
'</uniqueid></movie>', encoding="utf-8")
"</uniqueid></movie>",
encoding="utf-8",
)
assert read_nfo(video).csfd_url == "https://www.csfd.cz/film/9499-matrix/"
def test_csfd_url_from_legacy_csfdid_tag(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
"<movie><csfdid>12345</csfdid></movie>", encoding="utf-8")
"<movie><csfdid>12345</csfdid></movie>", encoding="utf-8"
)
assert read_nfo(video).csfd_url == "https://www.csfd.cz/film/12345/"
def test_csfd_url_absent_is_none(tmp_path):
video = _movie(tmp_path)
video.with_suffix(".nfo").write_text(
"<movie><title>Matrix</title></movie>", encoding="utf-8")
"<movie><title>Matrix</title></movie>", encoding="utf-8"
)
assert read_nfo(video).csfd_url is None
@@ -115,9 +130,10 @@ def test_field_values():
def test_refresh_tags_from_nfo(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")