about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-02-24 02:32:40 +0000
committerdirkf <fieldhouse@gmx.net>2023-02-24 12:22:16 +0000
commite67e52a8f8fd7e76253e416da76570af8da200d0 (patch)
tree313bf98120b6d76278cc93d17cb28a6321cc0f06 /test
parent1d3751c3fe50b203d3e2bff71d866c8c500f8288 (diff)
downloadyoutube-dl-e67e52a8f8fd7e76253e416da76570af8da200d0.tar.gz
youtube-dl-e67e52a8f8fd7e76253e416da76570af8da200d0.tar.xz
youtube-dl-e67e52a8f8fd7e76253e416da76570af8da200d0.zip
[test] Support test-case with volatile ID (eg live show)
Signalled by regexp ID value, eg: `'id': r're:[\da-zA-Z_-]{8,}'`
Diffstat (limited to 'test')
-rw-r--r--test/test_download.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 19936969f..d50008307 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -148,6 +148,7 @@ def generator(test_case, tname):
                 try_rm(tc_filename)
                 try_rm(tc_filename + '.part')
                 try_rm(os.path.splitext(tc_filename)[0] + '.info.json')
+
         try_rm_tcs_files()
         try:
             try_num = 1
@@ -213,7 +214,15 @@ def generator(test_case, tname):
                 # First, check test cases' data against extracted data alone
                 expect_info_dict(self, tc_res_dict, tc.get('info_dict', {}))
                 # Now, check downloaded file consistency
+                # support test-case with volatile ID, signalled by regexp value
+                if tc.get('info_dict', {}).get('id', '').startswith('re:'):
+                    test_id = tc['info_dict']['id']
+                    tc['info_dict']['id'] = tc_res_dict['id']
+                else:
+                    test_id = None
                 tc_filename = get_tc_filename(tc)
+                if test_id:
+                    tc['info_dict']['id'] = test_id
                 if not test_case.get('params', {}).get('skip_download', False):
                     self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename)
                     self.assertTrue(tc_filename in finished_hook_called)