Merge branch 'master' of https://github.com/rg3/youtube-dl
[youtube-dl] / test / test_download.py
index 128ff9ae4fb7364a3f1ce0f77d4e6fa3724d85ab..40d596fdf1cf2e4b596917f28ecf431ef024014a 100644 (file)
@@ -74,9 +74,8 @@ def generator(test_case):
             print('Skipping: {0}'.format(test_case['skip']))
             return
 
-        params = dict(self.parameters) # Duplicate it locally
-        for p in test_case.get('params', {}):
-            params[p] = test_case['params'][p]
+        params = self.parameters.copy()
+        params.update(test_case.get('params', {}))
 
         fd = FileDownloader(params)
         fd.add_info_extractor(ie())
@@ -86,12 +85,14 @@ def generator(test_case):
         test_cases = test_case.get('playlist', [test_case])
         for tc in test_cases:
             _try_rm(tc['file'])
+            _try_rm(tc['file'] + '.part')
             _try_rm(tc['file'] + '.info.json')
         try:
             fd.download([test_case['url']])
 
             for tc in test_cases:
-                self.assertTrue(os.path.exists(tc['file']))
+                if not test_case.get('params', {}).get('skip_download', False):
+                    self.assertTrue(os.path.exists(tc['file']))
                 self.assertTrue(os.path.exists(tc['file'] + '.info.json'))
                 if 'md5' in tc:
                     md5_for_file = _file_md5(tc['file'])
@@ -107,6 +108,7 @@ def generator(test_case):
         finally:
             for tc in test_cases:
                 _try_rm(tc['file'])
+                _try_rm(tc['file'] + '.part')
                 _try_rm(tc['file'] + '.info.json')
 
     return test_template