From: Filippo Valsorda Date: Tue, 1 Jan 2013 15:07:26 +0000 (+0100) Subject: In tests.json file and md5 join in a 'files' list to handle multiple-file IEs X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=6535e9511fc18eee2fc640c77fd42a4a39791915;p=youtube-dl In tests.json file and md5 join in a 'files' list to handle multiple-file IEs --- diff --git a/test/test_download.py b/test/test_download.py index 1ee1b334d..5b35c37e7 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -54,9 +54,10 @@ class TestDownload(unittest.TestCase): self.tearDown() def tearDown(self): - for fn in [ test.get('file', False) for test in self.defs ]: - if fn and os.path.exists(fn): - os.remove(fn) + for files in [ test['files'] for test in self.defs ]: + for fn, md5 in files: + if os.path.exists(fn): + os.remove(fn) ### Dinamically generate tests @@ -67,9 +68,6 @@ def generator(test_case): if not ie._WORKING: print('Skipping: IE marked as not _WORKING') return - if not test_case['file']: - print('Skipping: No output file specified') - return if 'skip' in test_case: print('Skipping: {0}'.format(test_case['skip'])) return @@ -84,10 +82,11 @@ def generator(test_case): fd.add_info_extractor(getattr(youtube_dl.InfoExtractors, ien + 'IE')()) fd.download([test_case['url']]) - self.assertTrue(os.path.exists(test_case['file'])) - if 'md5' in test_case: - md5_for_file = _file_md5(test_case['file']) - self.assertEqual(md5_for_file, test_case['md5']) + for filename, md5 in test_case['files']: + self.assertTrue(os.path.exists(filename)) + if md5: + md5_for_file = _file_md5(filename) + self.assertEqual(md5_for_file, md5) info_dict = fd.processed_info_dicts[0] for (info_field, value) in test_case.get('info_dict', {}).items(): if value.startswith('md5:'): diff --git a/test/tests.json b/test/tests.json index 61914e868..7c3986625 100644 --- a/test/tests.json +++ b/test/tests.json @@ -1,8 +1,8 @@ [ { "name": "Youtube", - "url": "http://www.youtube.com/watch?v=BaW_jenozKc", - "file": "BaW_jenozKc.mp4", + "url": "http://www.youtube.com/watch?v=BaW_jenozKc", + "files": [[ "BaW_jenozKc.mp4", false ]], "info_dict": { "title": "youtube-dl test video \"'/\\ä↭𝕐", "uploader": "Philipp Hagemeister", @@ -13,33 +13,29 @@ }, { "name": "Dailymotion", - "md5": "392c4b85a60a90dc4792da41ce3144eb", - "url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech", - "file": "x33vw9.mp4" + "url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech", + "files": [[ "x33vw9.mp4", "392c4b85a60a90dc4792da41ce3144eb" ]] }, { "name": "Metacafe", - "add_ie": ["Youtube"], - "url": "http://metacafe.com/watch/yt-_aUehQsCQtM/the_electric_company_short_i_pbs_kids_go/", - "file": "_aUehQsCQtM.flv" + "add_ie": [ "Youtube" ], + "url": "http://metacafe.com/watch/yt-_aUehQsCQtM/the_electric_company_short_i_pbs_kids_go/", + "files": [[ "_aUehQsCQtM.flv", false ]] }, { "name": "BlipTV", - "md5": "b2d849efcf7ee18917e4b4d9ff37cafe", - "url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352", - "file": "5779306.m4v" + "url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352", + "files": [[ "5779306.m4v", "b2d849efcf7ee18917e4b4d9ff37cafe" ]] }, { "name": "XVideos", - "md5": "1d0c835822f0a71a7bf011855db929d0", - "url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1", - "file": "939581.flv" + "url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1", + "files": [[ "939581.flv", "1d0c835822f0a71a7bf011855db929d0" ]] }, { "name": "Vimeo", - "md5": "8879b6cc097e987f02484baf890129e5", - "url": "http://vimeo.com/56015672", - "file": "56015672.mp4", + "url": "http://vimeo.com/56015672", + "files": [[ "56015672.mp4", "8879b6cc097e987f02484baf890129e5" ]], "info_dict": { "title": "youtube-dl test video - ★ \" ' 幸 / \\ ä ↭ 𝕐", "uploader": "Filippo Valsorda", @@ -50,70 +46,60 @@ }, { "name": "Soundcloud", - "md5": "ebef0a451b909710ed1d7787dddbf0d7", - "url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy", - "file": "62986583.mp3" + "url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy", + "files": [[ "62986583.mp3", "ebef0a451b909710ed1d7787dddbf0d7" ]] }, { "name": "StanfordOpenClassroom", - "md5": "544a9468546059d4e80d76265b0443b8", - "url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100", - "file": "PracticalUnix_intro-environment.mp4" + "url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100", + "files": [[ "PracticalUnix_intro-environment.mp4", "544a9468546059d4e80d76265b0443b8" ]] }, { "name": "XNXX", - "md5": "0831677e2b4761795f68d417e0b7b445", - "url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_", - "file": "1135332.flv" + "url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_", + "files": [[ "1135332.flv", "0831677e2b4761795f68d417e0b7b445" ]] }, { "name": "Youku", "url": "http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html", - "file": "XNDgyMDQ2NTQw_part00.flv", - "md5": "ffe3f2e435663dc2d1eea34faeff5b5b", + "files": [[ "XNDgyMDQ2NTQw_part00.flv", "ffe3f2e435663dc2d1eea34faeff5b5b" ]], "params": { "test": false } }, { "name": "NBA", "url": "http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html", - "file": "0021200253-okc-bkn-recap.nba.mp4", - "md5": "c0edcfc37607344e2ff8f13c378c88a4" + "files": [[ "0021200253-okc-bkn-recap.nba.mp4", "c0edcfc37607344e2ff8f13c378c88a4" ]] }, { "name": "JustinTV", "url": "http://www.twitch.tv/thegamedevhub/b/296128360", - "file": "296128360.flv", - "md5": "ecaa8a790c22a40770901460af191c9a" + "files": [[ "296128360.flv", "ecaa8a790c22a40770901460af191c9a" ]] }, { "name": "MyVideo", "url": "http://www.myvideo.de/watch/8229274/bowling_fail_or_win", - "file": "8229274.flv", - "md5": "2d2753e8130479ba2cb7e0a37002053e" + "files": [[ "8229274.flv", "2d2753e8130479ba2cb7e0a37002053e" ]] }, { "name": "Escapist", "url": "http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate", - "file": "6618-Breaking-Down-Baldurs-Gate.flv", - "md5": "c6793dbda81388f4264c1ba18684a74d", + "files": [[ "6618-Breaking-Down-Baldurs-Gate.flv", "c6793dbda81388f4264c1ba18684a74d" ]], "skip": "Fails with timeout on Travis" }, { "name": "GooglePlus", "url": "https://plus.google.com/u/0/108897254135232129896/posts/ZButuJc6CtH", - "file": "ZButuJc6CtH.flv" + "files": [[ "ZButuJc6CtH.flv", false ]] }, { "name": "FunnyOrDie", "url": "http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version", - "file": "0732f586d7.mp4", - "md5": "f647e9e90064b53b6e046e75d0241fbd" + "files": [[ "0732f586d7.mp4", "f647e9e90064b53b6e046e75d0241fbd" ]] }, { "name": "TweetReel", "url": "http://tweetreel.com/?77smq", - "file": "77smq.mov", - "md5": "56b4d9ca9de467920f3f99a6d91255d6", + "files": [[ "77smq.mov", "56b4d9ca9de467920f3f99a6d91255d6" ]], "info_dict": { "uploader": "itszero", "uploader_id": "itszero", @@ -124,8 +110,8 @@ { "name": "Steam", "url": "http://store.steampowered.com/video/105600/", - "file": "81300.flv", - "md5": "f870007cee7065d7c76b88f0a45ecc07", + "files": [[ "81300.flv", "f870007cee7065d7c76b88f0a45ecc07" ], + [ "80859.flv", "61aaf31a5c5c3041afb58fb83cbb5751" ]], "info_dict": { "title": "Terraria 1.1 Trailer" }