Always truncate files to 10241 bytes with --test

This should prevent issues like that in #13449 where the FFmpeg
downloader was not reliably trimming to the correct length.
This commit is contained in:
Kevin Mark 2017-07-08 19:19:30 -04:00
parent 9be9ec5980
commit c53c6765fd

View File

@ -358,7 +358,14 @@ class FileDownloader(object):
else '%.2f' % sleep_interval))
time.sleep(sleep_interval)
return self.real_download(filename, info_dict)
real_download_result = self.real_download(filename, info_dict)
if real_download_result and self.params.get('test', False):
f = open(filename, 'ab')
f.truncate(self._TEST_FILE_SIZE)
f.close()
return real_download_result
def real_download(self, filename, info_dict):
"""Real download process. Redefine in subclasses."""