Skip to content

Commit

Permalink
update tests so it works on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
souzatharsis committed Oct 16, 2024
1 parent ffa9286 commit c6cba93
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ langchain-community = "^0.3.2"
types-pyyaml = "^6.0.12.20240917"
nest-asyncio = "^1.6.0"
ffmpeg = "^1.4"
pytest = "^8.3.3"


[tool.poetry.group.dev.dependencies]
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ certifi==2024.8.30 ; python_version >= "3.11" and python_version < "4.0"
cffi==1.17.1 ; python_version >= "3.11" and python_version < "4.0" and implementation_name == "pypy"
charset-normalizer==3.4.0 ; python_version >= "3.11" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.11" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32")
colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and (sys_platform == "win32" or platform_system == "Windows")
cython==3.0.11 ; python_version >= "3.11" and python_version < "4.0"
dataclasses-json==0.6.7 ; python_version >= "3.11" and python_version < "4.0"
defusedxml==0.7.1 ; python_version >= "3.11" and python_version < "4.0"
Expand Down Expand Up @@ -53,6 +53,7 @@ httpx-sse==0.4.0 ; python_version >= "3.11" and python_version < "4.0"
httpx==0.27.2 ; python_version >= "3.11" and python_version < "4.0"
idna==3.10 ; python_version >= "3.11" and python_version < "4.0"
imagesize==1.4.1 ; python_version >= "3.11" and python_version < "4.0"
iniconfig==2.0.0 ; python_version >= "3.11" and python_version < "4.0"
jinja2==3.1.4 ; python_version >= "3.11" and python_version < "4.0"
jiter==0.6.1 ; python_version >= "3.11" and python_version < "4.0"
jsonpatch==1.33 ; python_version >= "3.11" and python_version < "4.0"
Expand Down Expand Up @@ -90,6 +91,7 @@ pandas==2.2.3 ; python_version >= "3.11" and python_version < "4.0"
pandoc==2.4 ; python_version >= "3.11" and python_version < "4.0"
pandocfilters==1.5.1 ; python_version >= "3.11" and python_version < "4.0"
platformdirs==4.3.6 ; python_version >= "3.11" and python_version < "4.0"
pluggy==1.5.0 ; python_version >= "3.11" and python_version < "4.0"
plumbum==1.9.0 ; python_version >= "3.11" and python_version < "4.0"
ply==3.11 ; python_version >= "3.11" and python_version < "4.0"
propcache==0.2.0 ; python_version >= "3.11" and python_version < "4.0"
Expand All @@ -105,6 +107,7 @@ pydub==0.25.1 ; python_version >= "3.11" and python_version < "4.0"
pygments==2.18.0 ; python_version >= "3.11" and python_version < "4.0"
pymupdf==1.24.11 ; python_version >= "3.11" and python_version < "4.0"
pyparsing==3.2.0 ; python_version >= "3.11" and python_version < "4.0"
pytest==8.3.3 ; python_version >= "3.11" and python_version < "4.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.11" and python_version < "4.0"
python-dotenv==1.0.1 ; python_version >= "3.11" and python_version < "4.0"
python-levenshtein==0.26.0 ; python_version >= "3.11" and python_version < "4.0"
Expand Down
35 changes: 19 additions & 16 deletions tests/test_audio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
import pytest
import os
from podcastfy.text_to_speech import TextToSpeech

Expand All @@ -9,27 +10,29 @@ def setUp(self):
self.output_dir = "tests/data/audio"
os.makedirs(self.output_dir, exist_ok=True)

# def test_text_to_speech_openai(self):
# tts = TextToSpeech(model="openai")
# output_file = os.path.join(self.output_dir, "test_openai.mp3")
# tts.convert_to_speech(self.test_text, output_file)
@pytest.mark.skip(reason="Testing edge only on Github Action as it's free")
def test_text_to_speech_openai(self):
tts = TextToSpeech(model="openai")
output_file = os.path.join(self.output_dir, "test_openai.mp3")
tts.convert_to_speech(self.test_text, output_file)

# self.assertTrue(os.path.exists(output_file))
# self.assertGreater(os.path.getsize(output_file), 0)
self.assertTrue(os.path.exists(output_file))
self.assertGreater(os.path.getsize(output_file), 0)

# # Clean up
# os.remove(output_file)
# Clean up
os.remove(output_file)

# def test_text_to_speech_elevenlabs(self):
# tts = TextToSpeech(model="elevenlabs")
# output_file = os.path.join(self.output_dir, "test_elevenlabs.mp3")
# tts.convert_to_speech(self.test_text, output_file)
@pytest.mark.skip(reason="Testing edge only on Github Action as it's free")
def test_text_to_speech_elevenlabs(self):
tts = TextToSpeech(model="elevenlabs")
output_file = os.path.join(self.output_dir, "test_elevenlabs.mp3")
tts.convert_to_speech(self.test_text, output_file)

# self.assertTrue(os.path.exists(output_file))
# self.assertGreater(os.path.getsize(output_file), 0)
self.assertTrue(os.path.exists(output_file))
self.assertGreater(os.path.getsize(output_file), 0)

# # Clean up
# os.remove(output_file)
# Clean up
os.remove(output_file)

def test_text_to_speech_edge(self):
tts = TextToSpeech(model="edge")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_content_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
import pytest
from podcastfy.utils.config import load_config
from podcastfy.content_parser.content_extractor import ContentExtractor
from podcastfy.content_parser.youtube_transcriber import YouTubeTranscriber
Expand All @@ -11,6 +12,7 @@ def test_content_extractor(self):
# Add tests for ContentExtractor
pass

@pytest.mark.skip(reason="IP getting blocked by YouTube when running from GitHub Actions")
def test_youtube_transcriber(self):
"""
Test the YouTubeTranscriber class to ensure it correctly extracts and cleans transcripts from a YouTube video.
Expand Down

0 comments on commit c6cba93

Please sign in to comment.