mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-06 07:55:10 +00:00
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -70,21 +70,6 @@ def test_failed_ffmpeg_concat_writes_nothing_to_the_terminal(
|
||||
assert save_path.read_bytes() == b"segment-0segment-1segment-2"
|
||||
|
||||
|
||||
def test_failed_ffmpeg_concat_logs_the_reason(
|
||||
tmp_path: Path, segments: list[Path], monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
def fake_run(args, **kwargs):
|
||||
raise subprocess.CalledProcessError(1, args, output="", stderr=FFMPEG_ERROR)
|
||||
|
||||
monkeypatch.setattr("unshackle.core.manifests.hls.binaries.FFMPEG", Path("ffmpeg"))
|
||||
monkeypatch.setattr("unshackle.core.manifests.hls.subprocess.run", fake_run)
|
||||
|
||||
with caplog.at_level("DEBUG", logger="HLS"):
|
||||
HLS.merge_segments(segments=segments, save_path=tmp_path / "Audio.mp4")
|
||||
|
||||
assert FFMPEG_ERROR in caplog.text
|
||||
|
||||
|
||||
def test_binary_concat_advances_progress_per_segment(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""FFmpeg concat reports nothing, so the fallback is the only place a count can come from."""
|
||||
segments = []
|
||||
@@ -106,15 +91,6 @@ def test_binary_concat_advances_progress_per_segment(tmp_path: Path, monkeypatch
|
||||
assert (tmp_path / "out.mp4").stat().st_size == 4 * 16
|
||||
|
||||
|
||||
def test_merge_segments_without_progress_still_works(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""progress stays optional; other callers pass nothing."""
|
||||
seg = tmp_path / "seg0.mp4"
|
||||
seg.write_bytes(b"\x01" * 8)
|
||||
monkeypatch.setattr("unshackle.core.manifests.hls.binaries.FFMPEG", None)
|
||||
size = HLS.merge_segments(segments=[seg], save_path=tmp_path / "out.mp4")
|
||||
assert size == 8
|
||||
|
||||
|
||||
def test_cleanup_never_climbs_past_the_segment_store(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""
|
||||
A download directory may itself say "_segments". Only the track's own segment store
|
||||
@@ -172,15 +148,3 @@ def test_segment_delete_error_after_ffmpeg_success_keeps_the_output(
|
||||
|
||||
assert size == len(b"merged")
|
||||
assert save_path.read_bytes() == b"merged"
|
||||
|
||||
|
||||
def test_ffmpeg_timeout_grows_with_input_size(tmp_path: Path, segments: list[Path], ffmpeg_ok: list[dict]) -> None:
|
||||
HLS.merge_segments(segments=segments, save_path=tmp_path / "small.mp4")
|
||||
|
||||
segments[0].parent.mkdir(exist_ok=True)
|
||||
for i, path in enumerate(segments):
|
||||
path.write_bytes(f"segment-{i}".encode())
|
||||
segments[0].write_bytes(b"\0" * 10 * 1024 * 1024)
|
||||
HLS.merge_segments(segments=segments, save_path=tmp_path / "large.mp4")
|
||||
|
||||
assert [call["timeout"] for call in ffmpeg_ok] == [300, 302]
|
||||
|
||||
Reference in New Issue
Block a user