summaryrefslogtreecommitdiffstats
path: root/test/test_download.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/test_download.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 2530792..3f36869 100755
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -20,7 +20,6 @@ from test.helper import (
gettestcases,
getwebpagetestcases,
is_download_test,
- report_warning,
try_rm,
)
@@ -94,7 +93,7 @@ def generator(test_case, tname):
'playlist', [] if is_playlist else [test_case])
def print_skipping(reason):
- print('Skipping %s: %s' % (test_case['name'], reason))
+ print('Skipping {}: {}'.format(test_case['name'], reason))
self.skipTest(reason)
if not ie.working():
@@ -117,7 +116,7 @@ def generator(test_case, tname):
for other_ie in other_ies:
if not other_ie.working():
- print_skipping('test depends on %sIE, marked as not WORKING' % other_ie.ie_key())
+ print_skipping(f'test depends on {other_ie.ie_key()}IE, marked as not WORKING')
params = get_params(test_case.get('params', {}))
params['outtmpl'] = tname + '_' + params['outtmpl']
@@ -148,10 +147,7 @@ def generator(test_case, tname):
return False
if err.__class__.__name__ == expected_exception:
return True
- for exc in err.exc_info:
- if exc.__class__.__name__ == expected_exception:
- return True
- return False
+ return any(exc.__class__.__name__ == expected_exception for exc in err.exc_info)
def try_rm_tcs_files(tcs=None):
if tcs is None:
@@ -181,8 +177,7 @@ def generator(test_case, tname):
raise
if try_num == RETRIES:
- report_warning('%s failed due to network errors, skipping...' % tname)
- return
+ raise
print(f'Retrying: {try_num} failed tries\n\n##########\n\n')
@@ -244,9 +239,8 @@ def generator(test_case, tname):
got_fsize = os.path.getsize(tc_filename)
assertGreaterEqual(
self, got_fsize, expected_minsize,
- 'Expected %s to be at least %s, but it\'s only %s ' %
- (tc_filename, format_bytes(expected_minsize),
- format_bytes(got_fsize)))
+ f'Expected {tc_filename} to be at least {format_bytes(expected_minsize)}, '
+ f'but it\'s only {format_bytes(got_fsize)} ')
if 'md5' in tc:
md5_for_file = _file_md5(tc_filename)
self.assertEqual(tc['md5'], md5_for_file)
@@ -255,7 +249,7 @@ def generator(test_case, tname):
info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json'
self.assertTrue(
os.path.exists(info_json_fn),
- 'Missing info file %s' % info_json_fn)
+ f'Missing info file {info_json_fn}')
with open(info_json_fn, encoding='utf-8') as infof:
info_dict = json.load(infof)
expect_info_dict(self, info_dict, tc.get('info_dict', {}))