X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=test%2Ftest_download.py;h=f1bccf58c5a2eaab0fbb8d60bb1185007eae0ee8;hb=5011cded16d15bb03c2f172ddae81499d764e28a;hp=e36774de97c09ddb49a99d6e9edba7b266eb998d;hpb=d8bbf2018effb0043dd418596ef1ab729239e129;p=youtube-dl.git diff --git a/test/test_download.py b/test/test_download.py index e36774de9..f1bccf58c 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -82,6 +82,11 @@ def generator(test_case): fd.add_info_extractor(ie()) for ien in test_case.get('add_ie', []): fd.add_info_extractor(getattr(youtube_dl.InfoExtractors, ien + 'IE')()) + finished_hook_called = set() + def _hook(status): + if status['status'] == 'finished': + finished_hook_called.add(status['filename']) + fd.add_progress_hook(_hook) test_cases = test_case.get('playlist', [test_case]) for tc in test_cases: @@ -93,7 +98,8 @@ def generator(test_case): for tc in test_cases: if not test_case.get('params', {}).get('skip_download', False): - self.assertTrue(os.path.exists(tc['file'])) + self.assertTrue(os.path.exists(tc['file']), msg='Missing file ' + tc['file']) + self.assertTrue(tc['file'] in finished_hook_called) self.assertTrue(os.path.exists(tc['file'] + '.info.json')) if 'md5' in tc: md5_for_file = _file_md5(tc['file']) @@ -101,11 +107,7 @@ def generator(test_case): with io.open(tc['file'] + '.info.json', encoding='utf-8') as infof: info_dict = json.load(infof) for (info_field, value) in tc.get('info_dict', {}).items(): - if value.startswith('md5:'): - md5_info_value = hashlib.md5(info_dict.get(info_field, '')).hexdigest() - self.assertEqual(value[3:], md5_info_value) - else: - self.assertEqual(value, info_dict.get(info_field)) + self.assertEqual(value, info_dict.get(info_field)) finally: for tc in test_cases: _try_rm(tc['file'])