aboutsummaryrefslogtreecommitdiff
path: root/test/test_download.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-06-27 19:13:11 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-06-27 19:13:11 +0200
commit2eb88d953f25e178881c1415c68fea1f770a7ee6 (patch)
tree42832aa966220d4bfbd8fced85b3bd6e3e524846 /test/test_download.py
parent6b47c7f24ef7fee9f714a71f51c27ff61ed632e9 (diff)
downloadyoutube-dl-2eb88d953f25e178881c1415c68fea1f770a7ee6.tar.xz
Allow _TESTS attribute for IEs with multiple tests
This also improves the numbering of duplicate tests
Diffstat (limited to 'test/test_download.py')
-rw-r--r--test/test_download.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 0428a79fe..dbb73d32a 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -63,6 +63,9 @@ for ie in youtube_dl.extractor.gen_extractors():
if t:
t['name'] = type(ie).__name__[:-len('IE')]
defs.append(t)
+ for t in getattr(ie, '_TESTS', []):
+ t['name'] = type(ie).__name__[:-len('IE')]
+ defs.append(t)
with io.open(PARAMETERS_FILE, encoding='utf-8') as pf:
@@ -162,9 +165,12 @@ def generator(test_case):
### And add them to TestDownload
for n, test_case in enumerate(defs):
test_method = generator(test_case)
- test_method.__name__ = "test_{0}".format(test_case["name"])
- if getattr(TestDownload, test_method.__name__, False):
- test_method.__name__ = "test_{0}_{1}".format(test_case["name"], n)
+ tname = 'test_' + str(test_case['name'])
+ i = 1
+ while hasattr(TestDownload, tname):
+ tname = 'test_' + test_case['name'] + '_' + str(i)
+ i += 1
+ test_method.__name__ = tname
setattr(TestDownload, test_method.__name__, test_method)
del test_method