Cleanup/testing suite (#1136)

* clean testing suite

* clean testing suite part2

* clean testing suite part3

* add todos

* extend testing suite and kill some mutants

* fix hashes

* fix lint

* fix test

* fix test
This commit is contained in:
Henry Ruhs
2026-06-01 08:54:37 +02:00
committed by GitHub
parent 460c65004b
commit 0f5f75ba51
6 changed files with 120 additions and 159 deletions
+27
View File
@@ -0,0 +1,27 @@
import pytest
from facefusion.apis.asset_helper import detect_media_type_by_path, extract_image_metadata
from facefusion.download import conditional_download
from .assert_helper import get_test_example_file, get_test_examples_directory
@pytest.fixture(scope = 'module', autouse = True)
def before_all() -> None:
conditional_download(get_test_examples_directory(),
[
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.jpg',
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/source.mp3',
'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4'
])
def test_detect_media_type() -> None:
assert detect_media_type_by_path(get_test_example_file('source.jpg')) == 'image'
assert detect_media_type_by_path(get_test_example_file('target-240p.mp4')) == 'video'
assert detect_media_type_by_path(get_test_example_file('source.mp3')) == 'audio'
def test_extract_image_metadata() -> None:
image_metadata = extract_image_metadata(get_test_example_file('source.jpg'))
assert image_metadata.get('resolution') == (1024, 1024)