Skip to content

Commit

Permalink
Fix plugin tests
Browse files Browse the repository at this point in the history
Add six in dependencies for openatv master.
Use authentication for plugin test to avoid Sign in to confirm you’re not a bot error.
Fix error in YouTubeVideoUrl when no formats are found.

force-test
  • Loading branch information
Taapat committed Aug 20, 2024
1 parent 717bbde commit e791ce6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
sed -i 's/ != video_id/ != video_id or video_id in ("bWgPKTOMoSY", "9UMxZofMNbA")/g' src/YouTubeVideoUrl.py
- name: Test code with pytest
run: |
pytest -rx -v --cov=src --cov-report=xml --cov-report=html
YOUTUBE_PLUGIN_TOKEN=${{ secrets.YOUTUBE_PLUGIN_TOKEN }} pytest -rx -v --cov=src --cov-report=xml --cov-report=html
mv .coverage .coverage_${{ matrix.python-version }}
- name: Upload code coverage results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
- name: Install additional dependencies
if: matrix.enigma2-version == 'openatv master 3.12' || matrix.enigma2-version == 'OpenViX Developer 3.12'
run: |
pip install requests chardet
pip install requests chardet six
- name: Link plugin files for test
working-directory: './enigma2/lib/python/Plugins/Extensions'
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/YouTubeVideoUrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def _real_extract(self, video_id, yt_auth):
url = fmt.get('url')
if url:
break
if not url: # pragma: no cover
if not url and streaming_formats: # pragma: no cover
url = streaming_formats[0].get('url', '')

if not url:
Expand Down
4 changes: 3 additions & 1 deletion test/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ def get_video_id(q, event_type, order, s_type):

def get_url(videos):
from src.YouTubeVideoUrl import YouTubeVideoUrl
from src.YouTubeApi import YouTubeApi
ytdl = YouTubeVideoUrl()
video_url = ytdl.extract(videos)
ytapi = YouTubeApi(os.environ['YOUTUBE_PLUGIN_TOKEN'])
video_url = ytdl.extract(videos, ytapi.get_yt_auth())
video_url = video_url.split('&suburi=', 1)[0]
print('Video Url', video_url)
return video_url
Expand Down

0 comments on commit e791ce6

Please sign in to comment.