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
@@ -1,11 +1,7 @@
import json
from types import SimpleNamespace
import pytest
from unshackle.core import binaries
from unshackle.core.tracks import Audio, Tracks, Video
from unshackle.core.tracks.tracks import file_track_ids
def make_video(track_id: str, **data) -> Video:
@@ -36,18 +32,6 @@ def mux_until_mkvmerge_check(tracks: Tracks) -> None:
tracks.mux("Test Title")
def test_names_undeclared_video(monkeypatch):
monkeypatch.setattr(binaries, "MKVToolNix", None)
video = make_video("v1")
tracks = Tracks(video)
mux_until_mkvmerge_check(tracks)
assert video.needs_repack
assert video.data["audio_language"] == "zh"
assert video.embedded_audio_name() == "Chinese"
def test_service_declaration_is_preserved(monkeypatch):
monkeypatch.setattr(binaries, "MKVToolNix", None)
declared = make_video("v1", audio_language="th", audio_language_name="Thai [Original]")
@@ -100,17 +84,3 @@ def test_an_audio_track_with_own_stream_only_muxes_without_its_video(tmp_path, m
args = mux_args(Tracks(audio), {"video": 0, "audio": 1})
assert ("--no-video" in args) == own
assert args[args.index("--language") + 1] == ("1:th" if own else "0:th")
def test_repack_and_mux_share_the_embedded_audio_name():
assert make_video("v1", audio_language="zh").embedded_audio_name() == "Chinese"
assert make_video("v1", audio_language="zh", audio_language_name="Mandarin").embedded_audio_name() == "Mandarin"
def test_file_track_ids_reads_the_first_id_of_each_type(monkeypatch, tmp_path):
tracks = [{"id": 0, "type": "audio"}, {"id": 1, "type": "video"}, {"id": 2, "type": "audio"}]
reply = SimpleNamespace(stdout=json.dumps({"tracks": tracks}))
monkeypatch.setattr("unshackle.core.tracks.tracks.subprocess.run", lambda *a, **k: reply)
assert file_track_ids(tmp_path / "v.ts") == {"audio": 0, "video": 1}
monkeypatch.setattr("unshackle.core.tracks.tracks.subprocess.run", lambda *a, **k: SimpleNamespace(stdout=""))
assert file_track_ids(tmp_path / "v.ts") == {"video": 0, "audio": 1}