From 242d2af05b42c16b42e6036da5a26cae5e746bc7 Mon Sep 17 00:00:00 2001 From: Tharindu N <40334396+truethari@users.noreply.github.com> Date: Mon, 19 Apr 2021 19:17:33 +0530 Subject: [PATCH] Update tests --- .github/workflows/thumb-gen.yml | 7 ++----- tests/test_worker.py | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/thumb-gen.yml b/.github/workflows/thumb-gen.yml index ec6602c..ec917e8 100644 --- a/.github/workflows/thumb-gen.yml +++ b/.github/workflows/thumb-gen.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: thumb-gen on: @@ -8,7 +5,6 @@ on: branches: [ master ] paths-ignore: - '**/README.md' - - '**/README.rst' - 'thumb_gen/version.py' pull_request: branches: [ master ] @@ -31,8 +27,9 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install pytest Pillow infomedia opencv-python + pip install -r requirements.txt + python setup.py install sudo wget -P /home/ "https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4" - sudo apt-get install ffmpeg - name: Test with pytest run: | pytest tests diff --git a/tests/test_worker.py b/tests/test_worker.py index 2a1bed3..27a934a 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -1,12 +1,19 @@ import pytest -from thumb_gen.worker import Generator +from thumb_gen import Generator -def test_worker(): - #video_path, output_path='', custom_text='True', font_dir='', font_size=0 +#video_path, output_path='', custom_text=True, font_dir='', font_size=0, bg_colour='', font_colour='' + +def test_worker_1(): + video_path = "/home/sample-mp4-file.mp4" + output_path = "/home/runner/work/thumb-gen/thumb-gen/" + app = Generator(video_path, output_path, "thumb gen") + test_worker_value = app.run() + assert test_worker_value == True + +def test_worker_2(): video_path = "/home/sample-mp4-file.mp4" output_path = "/home/runner/work/thumb-gen/thumb-gen/" - custom_text = "thumb gen" - app = Generator(video_path, output_path, custom_text) + app = Generator(video_path, output_path, font_size=10, bg_colour="yellow", font_colour="black") test_worker_value = app.run() assert test_worker_value == True