mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 14:45:14 +00:00 
			
		
		
		
	[test_download] Check expected file minsize and md5 only when download is not skipped
This commit is contained in:
		| @@ -167,11 +167,6 @@ def generator(test_case): | |||||||
|                 if not test_case.get('params', {}).get('skip_download', False): |                 if not test_case.get('params', {}).get('skip_download', False): | ||||||
|                     self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename) |                     self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename) | ||||||
|                     self.assertTrue(tc_filename in finished_hook_called) |                     self.assertTrue(tc_filename in finished_hook_called) | ||||||
|                 info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json' |  | ||||||
|                 self.assertTrue(os.path.exists(info_json_fn)) |  | ||||||
|                 if 'md5' in tc: |  | ||||||
|                     md5_for_file = _file_md5(tc_filename) |  | ||||||
|                     self.assertEqual(md5_for_file, tc['md5']) |  | ||||||
|                     expected_minsize = tc.get('file_minsize', 10000) |                     expected_minsize = tc.get('file_minsize', 10000) | ||||||
|                     if expected_minsize is not None: |                     if expected_minsize is not None: | ||||||
|                         if params.get('test'): |                         if params.get('test'): | ||||||
| @@ -182,6 +177,11 @@ def generator(test_case): | |||||||
|                             'Expected %s to be at least %s, but it\'s only %s ' % |                             'Expected %s to be at least %s, but it\'s only %s ' % | ||||||
|                             (tc_filename, format_bytes(expected_minsize), |                             (tc_filename, format_bytes(expected_minsize), | ||||||
|                                 format_bytes(got_fsize))) |                                 format_bytes(got_fsize))) | ||||||
|  |                     if 'md5' in tc: | ||||||
|  |                         md5_for_file = _file_md5(tc_filename) | ||||||
|  |                         self.assertEqual(md5_for_file, tc['md5']) | ||||||
|  |                 info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json' | ||||||
|  |                 self.assertTrue(os.path.exists(info_json_fn)) | ||||||
|                 with io.open(info_json_fn, encoding='utf-8') as infof: |                 with io.open(info_json_fn, encoding='utf-8') as infof: | ||||||
|                     info_dict = json.load(infof) |                     info_dict = json.load(infof) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sergey M․
					Sergey M․