From bead4a6c5f0d22d33eb44d399af35c78e8be2ae2 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Mon, 21 Aug 2023 16:37:10 +0200 Subject: [PATCH] Basic testing for detect_fps --- tests/test_utilities.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_utilities.py diff --git a/tests/test_utilities.py b/tests/test_utilities.py new file mode 100644 index 00000000..251d57dd --- /dev/null +++ b/tests/test_utilities.py @@ -0,0 +1,21 @@ +import subprocess +import pytest + +from facefusion.utilities import conditional_download, detect_fps + + +@pytest.fixture(scope = 'module', autouse = True) +def setup() -> None: + conditional_download('.assets/examples', + [ + 'https://github.com/facefusion/facefusion-assets/releases/download/examples/target-1080p.mp4' + ]) + subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vf', 'fps=25', '.assets/examples/target-1080p-25fps.mp4' ]) + subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vf', 'fps=30', '.assets/examples/target-1080p-30fps.mp4' ]) + subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vf', 'fps=60', '.assets/examples/target-1080p-60fps.mp4' ]) + + +def test_detect_fps() -> None: + assert detect_fps('.assets/examples/target-1080p-25fps.mp4') == 25.0 + assert detect_fps('.assets/examples/target-1080p-30fps.mp4') == 30.0 + assert detect_fps('.assets/examples/target-1080p-60fps.mp4') == 60.0