Skip to content

Commit 56628e1

Browse files
committed
Fix ffprobe test failing on Alpine
1 parent a7fe235 commit 56628e1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/video/test_video.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,17 @@ def test_get_media_info(media_format, media, expected, test_files):
130130
with tempfile.TemporaryDirectory() as t:
131131
src = pathlib.Path(t).joinpath(media)
132132
shutil.copy2(test_files[media_format], src)
133-
assert get_media_info(src) == expected
133+
result = get_media_info(src)
134+
assert result.keys() == expected.keys()
135+
assert result["codecs"] == expected["codecs"]
136+
assert result["duration"] == expected["duration"]
137+
# for bitrate, we need to allow some variability, not all ffmpeg version are
138+
# reporting the same values (e.g. Alpine Linux is reporting 3837275 instead of
139+
# 3818365 for video.mp4) ; we allow 1% variability with following assertion
140+
assert (
141+
abs(100.0 * (result["bitrate"] - expected["bitrate"]) / expected["bitrate"])
142+
< 1
143+
)
134144

135145

136146
def test_preset_has_mime_and_ext():

0 commit comments

Comments
 (0)