Skip to content

Commit

Permalink
Try find fault reason
Browse files Browse the repository at this point in the history
force-test skip-release
  • Loading branch information
Taapat authored Aug 20, 2024
1 parent 717bbde commit caa51b4
Showing 1 changed file with 7 additions and 44 deletions.
51 changes: 7 additions & 44 deletions test/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,18 @@ def get_url(videos):


def check_example(q, event_type='', order='relevance', s_type='video', descr=''):
try:
videos = get_video_id(q=q, event_type=event_type, order=order, s_type=s_type)
except Exception as ex:
print('Error in get_video_id %s, try second time' % str(ex))
from time import sleep
sleep(10)
videos = get_video_id(q=q, event_type=event_type, order=order, s_type=s_type)
videos = get_video_id(q=q, event_type=event_type, order=order, s_type=s_type)
check_video_url(videos, descr=descr)


def check_video_url(videos, descr):
print('Test', descr)
try:
video_url = get_url(videos)
except Exception as ex:
if str(ex) == 'Too Many Requests':
pytest.xfail('Error in get_url, Too Many Requests')
elif str(ex) == 'No supported formats found in video info!':
pytest.xfail('Error in get_url, No supported formats found in video info!')
else:
raise RuntimeError(ex)
else:
from src.compat import compat_urlopen
response = compat_urlopen(video_url)
info = response.info()
print('Video Url info:')
print(info, descr, 'Video Url exist')
video_url = get_url(videos)
from src.compat import compat_urlopen
response = compat_urlopen(video_url)
info = response.info()
print('Video Url info:')
print(info, descr, 'Video Url exist')


def test_search_url():
Expand All @@ -115,28 +100,6 @@ def test_playlist():
video_list = (
('BaW_jenozKc', 'Use the first video ID'),
('YQHsXMglC9A', 'DASH mp4 video and audio'),
('a9LDPn-MO4I', '256k DASH audio via manifest'),
('T4XJQO3qol8', 'Controversy video'),
('__2ABJjxzNo', 'Ad is not captured for creator'),
('FIl7x6_3R5Y', 'Multiple DASH manifests'),
('lsguqyKfVQg', 'Title with JS-like syntax'),
('M4gD1WSo5mA', 'Licensed under Creative Commons'),
('eQcmzGIKrzg', 'Channel-like uploader_url'),
('uGpuVWrhIzE', 'Rental video preview'),
('iqKdEhx-dD4', 'YouTube Red with episode data'),
('MgNrAu2pzNs', 'Auto generated description'),
('MeJVWBSsPAY', 'Non-agegated non-embeddable'),
('zaPI8MvL8pg', 'Multifeed videos'),
('HtVdAasjOgU', 'Embeddable video'),
('bWgPKTOMoSY', 'Decrypting n-sig'),
('9UMxZofMNbA', 'm3u8 playlist'),
pytest.param('Tq92D6wQ1mg', 'Age gated video', marks=pytest.mark.xfail),
pytest.param('E8MCiceJJdY', 'Age gated video', marks=pytest.mark.xfail),
pytest.param('K9TRaGNnjEU', 'Age gated video', marks=pytest.mark.xfail),
pytest.param('6SJNVb0GnPI', 'Inappropriate video', marks=pytest.mark.xfail),
pytest.param('s7_qI6_mIXc', 'DRM protected video', marks=pytest.mark.xfail),
pytest.param('yYr8q0y5Jfg', 'Not available video', marks=pytest.mark.xfail),
pytest.param('wrong_id', 'Wrong id', marks=pytest.mark.xfail),
)


Expand Down

0 comments on commit caa51b4

Please sign in to comment.