summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYen Chi Hsuan <[email protected]>2015-10-21 00:37:28 +0800
committerYen Chi Hsuan <[email protected]>2017-02-19 21:26:35 +0800
commit8936f68a0ba3284c88ec619fb4cc22eb0499e7f3 (patch)
tree5a046603f06fcaaaed5d04722bb86862a666e911 /test
parentc58b7ffef43f60fa6a183c849cfdca42e36eae0c (diff)
downloadyoutube-dl-8936f68a0ba3284c88ec619fb4cc22eb0499e7f3.tar.gz
youtube-dl-8936f68a0ba3284c88ec619fb4cc22eb0499e7f3.zip
[travis] Run tests in parallel
[test_download] Print test names in case of network errors [test_download] Add comments for nose parameters [test_download] Modify outtmpl to prevent info JSON filename conflicts Thanks @jaimeMF for the idea. [travis] Only download tests should be run in parallel
Diffstat (limited to 'test')
-rw-r--r--test/test_download.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/test_download.py b/test/test_download.py
index 463952989..30034f978 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -65,6 +65,10 @@ defs = gettestcases()
class TestDownload(unittest.TestCase):
+ # Parallel testing in nosetests. See
+ # http://nose.readthedocs.org/en/latest/doc_tests/test_multiprocess/multiprocess.html
+ _multiprocess_shared_ = True
+
maxDiff = None
def setUp(self):
@@ -73,7 +77,7 @@ class TestDownload(unittest.TestCase):
# Dynamically generate tests
-def generator(test_case):
+def generator(test_case, tname):
def test_template(self):
ie = youtube_dl.extractor.get_info_extractor(test_case['name'])
@@ -102,6 +106,7 @@ def generator(test_case):
return
params = get_params(test_case.get('params', {}))
+ params['outtmpl'] = tname + '_' + params['outtmpl']
if is_playlist and 'playlist' not in test_case:
params.setdefault('extract_flat', 'in_playlist')
params.setdefault('skip_download', True)
@@ -146,7 +151,7 @@ def generator(test_case):
raise
if try_num == RETRIES:
- report_warning('Failed due to network errors, skipping...')
+ report_warning('%s failed due to network errors, skipping...' % tname)
return
print('Retrying: {0} failed tries\n\n##########\n\n'.format(try_num))
@@ -221,12 +226,12 @@ def generator(test_case):
# And add them to TestDownload
for n, test_case in enumerate(defs):
- test_method = generator(test_case)
tname = 'test_' + str(test_case['name'])
i = 1
while hasattr(TestDownload, tname):
tname = 'test_%s_%d' % (test_case['name'], i)
i += 1
+ test_method = generator(test_case, tname)
test_method.__name__ = str(tname)
setattr(TestDownload, test_method.__name__, test_method)
del test_method