about summary refs log tree commit diff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2022-08-08 08:09:55 +0100
committerGitHub <noreply@github.com>2022-08-08 08:09:55 +0100
commitefa723edc679e31307f91392d068c240dc79c4b7 (patch)
tree0d8c79da1e8ab616545a21a2bdbd007290a4ca48
parentadb5294177265ba35b45746dbb600965076ed150 (diff)
downloadyoutube-dl-efa723edc679e31307f91392d068c240dc79c4b7.tar.gz
youtube-dl-efa723edc679e31307f91392d068c240dc79c4b7.tar.xz
youtube-dl-efa723edc679e31307f91392d068c240dc79c4b7.zip
[test] Identify testcase errors better
-rw-r--r--test/test_download.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 6a6673bc2..5b95fa578 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -33,6 +33,7 @@ from youtube_dl.compat import (
 from youtube_dl.utils import (
     DownloadError,
     ExtractorError,
+    error_to_compat_str,
     format_bytes,
     UnavailableVideoError,
 )
@@ -108,7 +109,7 @@ def generator(test_case, tname):
         for tc in test_cases:
             info_dict = tc.get('info_dict', {})
             if not (info_dict.get('id') and info_dict.get('ext')):
-                raise Exception('Test definition incorrect. The output file cannot be known. Are both \'id\' and \'ext\' keys present?')
+                raise Exception('Test definition (%s) requires both \'id\' and \'ext\' keys present to define the output file' % (tname, ))
 
         if 'skip' in test_case:
             print_skipping(test_case['skip'])
@@ -161,6 +162,8 @@ def generator(test_case, tname):
                 except (DownloadError, ExtractorError) as err:
                     # Check if the exception is not a network related one
                     if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError, compat_http_client.BadStatusLine) or (err.exc_info[0] == compat_HTTPError and err.exc_info[1].code == 503):
+                        msg = getattr(err, 'msg', error_to_compat_str(err))
+                        err.msg = '%s (%s)' % (msg, tname, )
                         raise
 
                     if try_num == RETRIES: