aboutsummaryrefslogtreecommitdiff
path: root/test/test_download.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_download.py')
-rw-r--r--test/test_download.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 067bde4bb..db43e9962 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -17,7 +17,6 @@ import youtube_dl.YoutubeDL
import youtube_dl.extractor
from youtube_dl.utils import *
-DEF_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tests.json')
PARAMETERS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parameters.json")
RETRIES = 3
@@ -56,8 +55,9 @@ def _file_md5(fn):
with open(fn, 'rb') as f:
return hashlib.md5(f.read()).hexdigest()
-with io.open(DEF_FILE, encoding='utf-8') as deff:
- defs = json.load(deff)
+from helper import get_testcases
+defs = get_testcases()
+
with io.open(PARAMETERS_FILE, encoding='utf-8') as pf:
parameters = json.load(pf)
@@ -155,9 +155,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_' + str(test_case['name']) + '_' + str(i)
+ i += 1
+ test_method.__name__ = tname
setattr(TestDownload, test_method.__name__, test_method)
del test_method