mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-07-27 13:54:14 +09:00
[fix] test_external_downloader.py
This commit is contained in:
parent
02709d1935
commit
5c66a3d1b3
@ -7,9 +7,7 @@ import os
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
import unittest
|
||||
import warnings
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from test.helper import http_server_port, try_rm
|
||||
@ -66,6 +64,7 @@ class HTTPTestRequestHandler(compat_http_server.BaseHTTPRequestHandler):
|
||||
else:
|
||||
assert False
|
||||
|
||||
|
||||
class FakeLogger(object):
|
||||
def debug(self, msg):
|
||||
pass
|
||||
@ -76,6 +75,7 @@ class FakeLogger(object):
|
||||
def error(self, msg):
|
||||
pass
|
||||
|
||||
|
||||
class TestAria2pFD(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.httpd = compat_http_server.HTTPServer(
|
||||
@ -102,20 +102,15 @@ class TestAria2pFD(unittest.TestCase):
|
||||
self.assertEqual(os.path.getsize(encodeFilename(filename)), TEST_SIZE)
|
||||
try_rm(encodeFilename(filename))
|
||||
process.kill()
|
||||
except FileNotFoundError:
|
||||
warnings.warn("You haven't install aria2c. Cannot test Aria2pFD")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def download_all(self, params):
|
||||
for ep in ('regular', 'no-content-length', 'no-range', 'no-range-no-content-length'):
|
||||
self.download(params, ep)
|
||||
|
||||
def test_regular(self):
|
||||
try:
|
||||
import aria2p
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
self.download_all({'external_downloader': 'aria2p'})
|
||||
self.download_all({'external_downloader': 'aria2p'})
|
||||
|
||||
def test_chunked(self):
|
||||
self.download_all({
|
||||
|
Loading…
x
Reference in New Issue
Block a user