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
-50
View File
@@ -114,12 +114,6 @@ def test_plain_hdr10_ends_stop_after_the_sample(monkeypatch: pytest.MonkeyPatch)
assert len(probed) == 4
def test_two_encodes_at_one_resolution_are_all_probed(monkeypatch: pytest.MonkeyPatch) -> None:
videos, probed = ladder(monkeypatch, "++-++", heights=[2160, 1440, 1080, 1080, 720])
assert ranges(videos) == "++-++"
assert len(probed) == 5
def test_a_dv_ladder_keeps_its_range_and_is_sampled_apart_from_hdr10(monkeypatch: pytest.MonkeyPatch) -> None:
hdr = [hevc(f"h{i}-", 2160 - 100 * i, 100 - i) for i in range(6)]
dv = [hevc(f"d{i}+", 2160 - 100 * i, 100 - i, Video.Range.DV) for i in range(6)]
@@ -199,35 +193,11 @@ def test_probed_tracks_leaves_a_remote_service_to_its_server(monkeypatch: pytest
assert probe_calls(monkeypatch, remote, workers=3) == []
@pytest.mark.parametrize("workers", [-1, "8"])
def test_a_bad_workers_count_is_an_error(monkeypatch: pytest.MonkeyPatch, workers: Any) -> None:
service = SimpleNamespace(
get_tracks=lambda title: SimpleNamespace(videos=[hevc("v", 2160)], audio=[]), session=None
)
with pytest.raises(ValueError, match="workers"):
probe_calls(monkeypatch, service, workers=workers)
def test_a_quoted_hdr10plus_probe_value_is_an_error() -> None:
with pytest.raises(SystemExit, match="hdr10plus_probe"):
Config(hdr10plus_probe="false")
def test_a_fragment_inside_the_first_window_needs_one_request(monkeypatch: pytest.MonkeyPatch) -> None:
media = fragment(nal(32, b"vps"), sei(4, HDR10PLUS_T35 + b"\x00" * 8), nal(1, b"\xff" * 64))
data = box(b"sidx", b"\x00" * 40) + media
ranges_asked: list[str] = []
def fake_get(url: str, session: Any, byte_range: str, accept_200: bool) -> bytes:
ranges_asked.append(byte_range)
return data
monkeypatch.setattr(hdr10plus, "first_segment", lambda track, session: ("https://cdn/v.mp4", 0))
monkeypatch.setattr(hdr10plus, "ranged_get", fake_get)
assert fragment_has_t35(hdr10plus.first_fragment(hevc("v", 2160), None) or b"", HDR10PLUS_T35) is True # type: ignore[arg-type]
assert len(ranges_asked) == 1
def test_a_quoted_dl_workers_value_works_like_the_cli(monkeypatch: pytest.MonkeyPatch) -> None:
service = SimpleNamespace(
get_tracks=lambda title: SimpleNamespace(videos=[hevc("v", 2160)], audio=[]), session=None
@@ -236,12 +206,6 @@ def test_a_quoted_dl_workers_value_works_like_the_cli(monkeypatch: pytest.Monkey
assert probe_calls(monkeypatch, service) == [8]
def test_a_dv_track_with_an_hdr10_base_lists_as_dv_plus_hdr10() -> None:
video = Video(url="https://x/v.mp4", language="en", codec=Video.Codec.HEVC, range_=Video.Range.DV, hdr10_base=True)
assert "[H.265, DV+HDR10]" in str(video)
assert track_from_dict(track_to_dict(video)).hdr10_base
def ts_packet(pid: int, section: bytes) -> bytes:
body = b"\x00" + section
return bytes([0x47, 0x40 | (pid >> 8), pid & 0xFF, 0x10]) + body + b"\xff" * (184 - len(body))
@@ -324,13 +288,6 @@ def test_audio_without_a_codec_takes_it_from_the_ts_stream_type(monkeypatch: pyt
assert "[Audio Vivid]" in str(Audio(url="https://x/a.m3u8", language="zh", codec=Audio.Codec.AV3A))
def test_an_avsa_registration_names_audio_vivid(monkeypatch: pytest.MonkeyPatch) -> None:
serve_segments(monkeypatch, {"a": ts((0x06, b"AVSA"))})
track = SimpleNamespace(id="a", codec=None, session=None)
hdr10plus.probe_audio_codecs([track], None, log=logging.getLogger("test"), workers=1) # type: ignore[arg-type,list-item]
assert track.codec == Audio.Codec.AV3A
def test_vivid_imports_by_value_and_matches_its_unprobed_reparse() -> None:
assert video_range("HDR Vivid") == video_range("vivid") == Video.Range.VIVID
for local, remote in ((Video.Range.HDR10, Video.Range.VIVID), (Video.Range.HLG, Video.Range.VIVID)):
@@ -523,10 +480,3 @@ def test_a_t35_message_after_a_payload_type_128_message_is_found() -> None:
t35 = bytes([4, len(CUVA_T35) + 4]) + CUVA_T35 + b"\x00" * 4
data = nal(39, sop + t35 + b"\x80")
assert fragment_has_t35(fragment(data, nal(1, b"\xff")), CUVA_T35) is True
def test_hevc_and_vvc_tracks_are_separate_ladders(monkeypatch: pytest.MonkeyPatch) -> None:
videos = [hevc(f"v{i}{mark}", 2160 - 100 * i, 100 - i) for i, mark in enumerate("++-++")]
videos[2].codec = Video.Codec.VVC
assert len(probe(monkeypatch, videos)) == 5
assert ranges(videos) == "++-++"