test: delete slow, timing-based and redundant tests

This commit is contained in:
imSp4rky
2026-12-05 15:20:05 -07:00
parent 783a2fc185
commit 3a0a74e694
292 changed files with 153 additions and 15174 deletions
-58
View File
@@ -2,7 +2,6 @@
from __future__ import annotations
import logging
from datetime import date
from typing import Any
@@ -193,36 +192,6 @@ def test_the_hints_take_the_title_before_the_source() -> None:
assert TitleMetadata(force_daily=True).daily_hint(daily_title) is True
@pytest.mark.parametrize(
("result", "level", "message"),
[
(None, logging.WARNING, "--enrich found no metadata"),
(
found(title="Real Name"),
logging.WARNING,
"--enrich source gave no year, language, kept the service's values",
),
(
found(title="Real", year=1999, original_language="ko"),
logging.INFO,
"Original language from metadata: ko",
),
],
ids=["nothing", "missing", "language"],
)
def test_enrich_reports_what_the_source_gave(
monkeypatch: pytest.MonkeyPatch,
caplog: pytest.LogCaptureFixture,
result: MetadataResult | None,
level: int,
message: str,
) -> None:
Providers(monkeypatch, result)
caplog.set_level(logging.INFO, logger="download")
TitleMetadata(tmdb_id=5).prepare(Movies([movie()]), enrich=True, tvdb_order="", continuous=False)
assert (level, message) in [(r.levelno, r.getMessage()) for r in caplog.records]
def test_enrich_fills_the_air_dates_of_a_daily_series(monkeypatch: pytest.MonkeyPatch) -> None:
tvdb = FakeTvdb({}, [{"seasonNumber": 1, "number": 1, "aired": "2026-08-10"}])
Providers(monkeypatch, found(tvdb_id=73871), tvdb)
@@ -231,14 +200,6 @@ def test_enrich_fills_the_air_dates_of_a_daily_series(monkeypatch: pytest.Monkey
assert [t.air_date for t in titles] == [date(2026, 8, 10)]
def test_a_listing_prints_the_search_match(monkeypatch: pytest.MonkeyPatch) -> None:
Providers(monkeypatch, found(title="The Show"))
monkeypatch.setattr(providers, "result_matches", lambda result, title: result.title == title)
with console.capture() as captured:
TitleMetadata().search(episode(1, 1), listing=True)
assert "Search -> The Show (ID 1396)" in captured.get()
def test_an_anilist_search_hit_keeps_its_anilist_id_for_the_tags(monkeypatch: pytest.MonkeyPatch) -> None:
hit = MetadataResult(
title="The Show", external_ids=ExternalIds(tmdb_id=37854, tmdb_kind="tv", anilist_id=21), source="anilist"
@@ -252,19 +213,6 @@ def test_an_anilist_search_hit_keeps_its_anilist_id_for_the_tags(monkeypatch: py
assert "Search -> The Show (ID 37854)" in captured.get()
def test_a_listing_with_no_movie_match_says_so(monkeypatch: pytest.MonkeyPatch) -> None:
Providers(monkeypatch, None)
with console.capture() as captured:
TitleMetadata().search(movie(), listing=True)
assert "Search -> No match found" in captured.get()
def test_a_movie_fetches_the_movie_external_ids(monkeypatch: pytest.MonkeyPatch) -> None:
calls = Providers(monkeypatch, None)
TitleMetadata(tmdb_id=5, cache=CACHE).search(movie())
assert calls.fetched == [(5, "movie", *CACHE)]
def test_the_service_provider_reaches_every_lookup(monkeypatch: pytest.MonkeyPatch) -> None:
calls = Providers(monkeypatch, found(tvdb_id=73871), FakeTvdb({(1, 1): (1, 1, None)}))
TitleMetadata(metadata_provider="tmdb").prepare(
@@ -286,12 +234,6 @@ def test_a_title_overrides_the_service_provider(monkeypatch: pytest.MonkeyPatch)
assert calls.resolved[0][1]["prefer"] == "tvdb"
def test_an_empty_title_provider_keeps_the_configured_order() -> None:
ep = episode(1, 1)
ep.metadata_provider = ""
assert TitleMetadata(metadata_provider="tmdb").provider_hint(ep) == ""
def test_a_per_title_anime_flag_keeps_the_service_provider(monkeypatch: pytest.MonkeyPatch) -> None:
calls = Providers(monkeypatch, None)
ep = episode(1, 1)