Industry leading face manipulation platform
Let's get started with pytest
henryruhs8d1da5ad49d7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 15ce7162..a0016eab 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -14,8 +14,8 @@ jobs:python-version: '3.10'- run: pip install flake8- run: pip install mypy- - run: flake8 run.py facefusion- - run: mypy run.py facefusion+ - run: flake8 run.py facefusion tests+ - run: mypy run.py facefusion teststest:strategy:matrix:@@ -31,13 +31,4 @@ jobs:with:python-version: '3.10'- run: pip install -r requirements-ci.txt- - run: curl --create-dirs --output .assets/examples/source.jpg https://github.com/facefusion/facefusion-assets/releases/download/examples/source.jpg- - run: curl --create-dirs --output .assets/examples/target-240p.mp4 https://github.com/facefusion/facefusion-assets/releases/download/examples/target-240p.mp4- - run: python run.py --source .assets/examples/source.jpg --target .assets/examples/target-240p.mp4 --output .assets/examples --trim-frame-end 30- if: matrix.os != 'windows-latest'- - run: python run.py --source .assets\examples\source.jpg --target .assets\examples\target-240p.mp4 --output .assets\examples --trim-frame-end 30- if: matrix.os == 'windows-latest'- - run: ffprobe -show_format -show_streams .assets/examples/source-target-240p.mp4- if: matrix.os != 'windows-latest'- - run: ffprobe -show_format -show_streams .assets\examples\source-target-240p.mp4- if: matrix.os == 'windows-latest'+ - run: pytestdiff --git a/requirements-ci.txt b/requirements-ci.txtindex b974e0e5..f381ae5d 100644--- a/requirements-ci.txt+++ b/requirements-ci.txt@@ -5,6 +5,7 @@ onnxruntime==1.15.1opencv-python==4.8.0.74opennsfw2==0.10.2protobuf==4.23.4+pytest==7.4.0psutil==5.9.5tensorflow==2.13.0-tqdm==4.65.0\ No newline at end of file+tqdm==4.65.0diff --git a/tests/__init__.py b/tests/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/tests/test_cli.py b/tests/test_cli.pynew file mode 100644index 00000000..138177ed--- /dev/null+++ b/tests/test_cli.py@@ -0,0 +1,29 @@+import subprocess+import pytest++from facefusion import wording+from facefusion.utilities import conditional_download++[email protected](scope = 'module', autouse = True)+def setup() -> None:+ conditional_download('.assets/examples',+ [+ 'https://github.com/facefusion/facefusion-assets/releases/download/examples/source.jpg',+ 'https://github.com/facefusion/facefusion-assets/releases/download/examples/target-1080p.mp4'+ ])+ subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vframes', '1', '.assets/examples/target-1080p.jpg' ])+++def test_image_to_image() -> None:+ commands = [ 'python', 'run.py', '-s', '.assets/examples/source.jpg', '-t', '.assets/examples/target-1080p.jpg', '-o', '.assets/examples' ]+ run = subprocess.run(commands, stdout = subprocess.PIPE)+ assert run.returncode == 0+ assert wording.get('processing_image_succeed') in run.stdout.decode()+++def test_image_to_video() -> None:+ commands = [ 'python', 'run.py', '-s', '.assets/examples/source.jpg', '-t', '.assets/examples/target-1080p.mp4', '-o', '.assets/examples', '--trim-frame-end', '10' ]+ run = subprocess.run(commands, stdout = subprocess.PIPE)+ assert run.returncode == 0+ assert wording.get('processing_video_succeed') in run.stdout.decode()