From 8af4ed7b4fb20190ec72e9ab6347e99deabe9bce Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Thu, 29 Nov 2012 16:35:57 +0100 Subject: Fix 2.6 nosetests --- test/test_download.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/test_download.py') diff --git a/test/test_download.py b/test/test_download.py index 0072d4aab..00b9a487b 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -38,13 +38,14 @@ try: except AttributeError: # Python 2.6 def _skip_unless(cond, reason='No reason given'): def resfunc(f): - def wfunc(*args, **kwargs): + # Start the function name with test to appease nosetests-2.6 + def test_wfunc(*args, **kwargs): if cond: return f(*args, **kwargs) else: print('Skipped test') return - return wfunc + return test_wfunc return resfunc _skip = lambda *args, **kwargs: _skip_unless(False, *args, **kwargs) -- cgit v1.2.3 From e91d2338d8f5be16d8cd052d38c20bec9d5583ab Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Thu, 29 Nov 2012 20:38:16 +0100 Subject: Fix MD5 calculation --- test/test_download.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'test/test_download.py') diff --git a/test/test_download.py b/test/test_download.py index 00b9a487b..571fbe9ad 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -20,19 +20,6 @@ import youtube_dl.InfoExtractors def _file_md5(fn): with open(fn, 'rb') as f: return hashlib.md5(f.read()).hexdigest() - -def md5_for_file(filename, block_size=2**20): - with open(filename) as f: - md5 = hashlib.md5() - while True: - data = f.read(block_size) - if not data: - break - md5.update(data) - return md5.hexdigest() -_file_md5 = md5_for_file - - try: _skip_unless = unittest.skipUnless except AttributeError: # Python 2.6 @@ -96,7 +83,7 @@ class DownloadTest(unittest.TestCase): fd.download(['http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352']) self.assertTrue(os.path.exists(filename)) md5_for_file = _file_md5(filename) - self.assertEqual(md5_for_file, '93c24d2f4e0782af13b8a7606ea97ba7') + self.assertEqual(md5_for_file, '4962f94441605832eb1008eb820ef47a') @_skip_unless(youtube_dl.InfoExtractors.XVideosIE._WORKING, "IE marked as not _WORKING") def test_XVideos(self): @@ -106,7 +93,7 @@ class DownloadTest(unittest.TestCase): fd.download(['http://www.xvideos.com/video939581/funny_porns_by_s_-1']) self.assertTrue(os.path.exists(filename)) md5_for_file = _file_md5(filename) - self.assertEqual(md5_for_file, '1ab4dedc01f771cb2a65e91caa801aaf') + self.assertEqual(md5_for_file, 'aecab2ea59b7996110a7e409f0c55da3') @_skip_unless(youtube_dl.InfoExtractors.VimeoIE._WORKING, "IE marked as not _WORKING") @_skip("No output file specified") @@ -127,7 +114,7 @@ class DownloadTest(unittest.TestCase): fd.download(['http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy']) self.assertTrue(os.path.exists(filename)) md5_for_file = _file_md5(filename) - self.assertEqual(md5_for_file, 'ce3775768ebb6432fa8495d446a078ed') + self.assertEqual(md5_for_file, 'c1b9b9ea8bfd620b96b2628664576e1c') @_skip_unless(youtube_dl.InfoExtractors.StanfordOpenClassroomIE._WORKING, "IE marked as not _WORKING") def test_StanfordOpenClassroom(self): @@ -137,7 +124,7 @@ class DownloadTest(unittest.TestCase): fd.download(['http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100']) self.assertTrue(os.path.exists(filename)) md5_for_file = _file_md5(filename) - self.assertEqual(md5_for_file, '22c8206291368c4e2c9c1a307f0ea0f4') + self.assertEqual(md5_for_file, '8aac7873a07dcfaed66b1559ab128514') @_skip_unless(youtube_dl.InfoExtractors.CollegeHumorIE._WORKING, "IE marked as not _WORKING") @_skip("No output file specified") @@ -158,7 +145,7 @@ class DownloadTest(unittest.TestCase): fd.download(['http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_']) self.assertTrue(os.path.exists(filename)) md5_for_file = _file_md5(filename) - self.assertEqual(md5_for_file, '5f0469c8d1dfd1bc38c8e6deb5e0a21d') + self.assertEqual(md5_for_file, 'c5c67df477eb0d9b058200351448ba4c') def tearDown(self): -- cgit v1.2.3 From d78be7e331f3f859f770a37a33286d42680114e7 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 30 Nov 2012 08:42:11 +0100 Subject: Add test for Youku (Mentioned in #314) --- test/test_download.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/test_download.py') diff --git a/test/test_download.py b/test/test_download.py index 571fbe9ad..c1f6ea556 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -147,6 +147,16 @@ class DownloadTest(unittest.TestCase): md5_for_file = _file_md5(filename) self.assertEqual(md5_for_file, 'c5c67df477eb0d9b058200351448ba4c') + @_skip_unless(youtube_dl.InfoExtractors.YoukuIE._WORKING, "IE marked as not _WORKING") + def test_Youku(self): + filename = 'XNDgyMDQ2NTQw_part00.flv' + fd = FileDownloader(self.parameters) + fd.add_info_extractor(youtube_dl.InfoExtractors.YoukuIE()) + fd.download(['http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html']) + self.assertTrue(os.path.exists(filename)) + md5_for_file = _file_md5(filename) + self.assertEqual(md5_for_file, 'ffe3f2e435663dc2d1eea34faeff5b5b') + def tearDown(self): if os.path.exists('BaW_jenozKc.mp4'): @@ -167,6 +177,8 @@ class DownloadTest(unittest.TestCase): # No file specified for CollegeHumor if os.path.exists('1135332.flv'): os.remove('1135332.flv') + if os.path.exists('XNDgyMDQ2NTQw_part00.flv'): + os.remove('XNDgyMDQ2NTQw_part00.flv') -- cgit v1.2.3 From 4083bf81a01f2e580f84f5db0274dd5585705ad6 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 3 Dec 2012 20:17:47 +0100 Subject: Correct metacafe test filename (happens to start with an underscore) --- test/test_download.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test_download.py') diff --git a/test/test_download.py b/test/test_download.py index c1f6ea556..fd7c1860c 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -67,7 +67,7 @@ class DownloadTest(unittest.TestCase): @_skip_unless(youtube_dl.InfoExtractors.MetacafeIE._WORKING, "IE marked as not _WORKING") def test_Metacafe(self): - filename = 'aUehQsCQtM.flv' + filename = '_aUehQsCQtM.flv' fd = FileDownloader(self.parameters) fd.add_info_extractor(youtube_dl.InfoExtractors.MetacafeIE()) fd.add_info_extractor(youtube_dl.InfoExtractors.YoutubeIE()) @@ -163,8 +163,8 @@ class DownloadTest(unittest.TestCase): os.remove('BaW_jenozKc.mp4') if os.path.exists('x33vw9.mp4'): os.remove('x33vw9.mp4') - if os.path.exists('aUehQsCQtM.flv'): - os.remove('aUehQsCQtM.flv') + if os.path.exists('_aUehQsCQtM.flv'): + os.remove('_aUehQsCQtM.flv') if os.path.exists('5779306.m4v'): os.remove('5779306.m4v') if os.path.exists('939581.flv'): -- cgit v1.2.3 From 863baa16eca7a98c38fb29c5e54f76df224f2351 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Fri, 7 Dec 2012 01:34:40 +0100 Subject: SoundCloud IDs have changed, fix tests --- test/test_download.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test_download.py') diff --git a/test/test_download.py b/test/test_download.py index fd7c1860c..6926dd04e 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -108,7 +108,7 @@ class DownloadTest(unittest.TestCase): @_skip_unless(youtube_dl.InfoExtractors.SoundcloudIE._WORKING, "IE marked as not _WORKING") def test_Soundcloud(self): - filename = 'n6FLbx6ZzMiu.mp3' + filename = '62986583.mp3' fd = FileDownloader(self.parameters) fd.add_info_extractor(youtube_dl.InfoExtractors.SoundcloudIE()) fd.download(['http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy']) @@ -170,8 +170,8 @@ class DownloadTest(unittest.TestCase): if os.path.exists('939581.flv'): os.remove('939581.flv') # No file specified for Vimeo - if os.path.exists('n6FLbx6ZzMiu.mp3'): - os.remove('n6FLbx6ZzMiu.mp3') + if os.path.exists('62986583.mp3'): + os.remove('62986583.mp3') if os.path.exists('PracticalUnix_intro-environment.mp4'): os.remove('PracticalUnix_intro-environment.mp4') # No file specified for CollegeHumor -- cgit v1.2.3