diff options
Diffstat (limited to 'test')
29 files changed, 77 insertions, 77 deletions
diff --git a/test/helper.py b/test/helper.py index f45818b0f..963c40508 100644 --- a/test/helper.py +++ b/test/helper.py @@ -10,13 +10,13 @@ import types import ssl import sys -import youtube_dlc.extractor -from youtube_dlc import YoutubeDL -from youtube_dlc.compat import ( +import yt_dlp.extractor +from yt_dlp import YoutubeDL +from yt_dlp.compat import ( compat_os_name, compat_str, ) -from youtube_dlc.utils import ( +from yt_dlp.utils import ( preferredencoding, write_string, ) @@ -90,7 +90,7 @@ class FakeYDL(YoutubeDL): def gettestcases(include_onlymatching=False): - for ie in youtube_dlc.extractor.gen_extractors(): + for ie in yt_dlp.extractor.gen_extractors(): for tc in ie.get_testcases(include_onlymatching): yield tc diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py index d742284bc..a08616694 100644 --- a/test/test_InfoExtractor.py +++ b/test/test_InfoExtractor.py @@ -10,10 +10,10 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL, expect_dict, expect_value, http_server_port -from youtube_dlc.compat import compat_etree_fromstring, compat_http_server -from youtube_dlc.extractor.common import InfoExtractor -from youtube_dlc.extractor import YoutubeIE, get_info_extractor -from youtube_dlc.utils import encode_data_uri, strip_jsonp, ExtractorError, RegexNotFoundError +from yt_dlp.compat import compat_etree_fromstring, compat_http_server +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.extractor import YoutubeIE, get_info_extractor +from yt_dlp.utils import encode_data_uri, strip_jsonp, ExtractorError, RegexNotFoundError import threading diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 43a5dcd74..6ae36638b 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -12,12 +12,12 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import copy from test.helper import FakeYDL, assertRegexpMatches -from youtube_dlc import YoutubeDL -from youtube_dlc.compat import compat_str, compat_urllib_error -from youtube_dlc.extractor import YoutubeIE -from youtube_dlc.extractor.common import InfoExtractor -from youtube_dlc.postprocessor.common import PostProcessor -from youtube_dlc.utils import ExtractorError, match_filter_func +from yt_dlp import YoutubeDL +from yt_dlp.compat import compat_str, compat_urllib_error +from yt_dlp.extractor import YoutubeIE +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.postprocessor.common import PostProcessor +from yt_dlp.utils import ExtractorError, match_filter_func TEST_URL = 'http://localhost/sample.mp4' diff --git a/test/test_YoutubeDLCookieJar.py b/test/test_YoutubeDLCookieJar.py index 615d8a9d8..0fadf812b 100644 --- a/test/test_YoutubeDLCookieJar.py +++ b/test/test_YoutubeDLCookieJar.py @@ -10,7 +10,7 @@ import tempfile import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.utils import YoutubeDLCookieJar +from yt_dlp.utils import YoutubeDLCookieJar class TestYoutubeDLCookieJar(unittest.TestCase): diff --git a/test/test_aes.py b/test/test_aes.py index ef1e1b189..efbdd2e1a 100644 --- a/test/test_aes.py +++ b/test/test_aes.py @@ -8,8 +8,8 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text -from youtube_dlc.utils import bytes_to_intlist, intlist_to_bytes +from yt_dlp.aes import aes_decrypt, aes_encrypt, aes_cbc_decrypt, aes_cbc_encrypt, aes_decrypt_text +from yt_dlp.utils import bytes_to_intlist, intlist_to_bytes import base64 # the encrypted data can be generate with 'devscripts/generate_aes_testdata.py' diff --git a/test/test_age_restriction.py b/test/test_age_restriction.py index b73bdd767..2eccd4718 100644 --- a/test/test_age_restriction.py +++ b/test/test_age_restriction.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import try_rm -from youtube_dlc import YoutubeDL +from yt_dlp import YoutubeDL def _download_restricted(url, filename, age): diff --git a/test/test_all_urls.py b/test/test_all_urls.py index c16b427a3..e6cb33cd2 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -12,7 +12,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import gettestcases -from youtube_dlc.extractor import ( +from yt_dlp.extractor import ( FacebookIE, gen_extractors, YoutubeIE, diff --git a/test/test_cache.py b/test/test_cache.py index 1167519d1..d6de22194 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -13,7 +13,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL -from youtube_dlc.cache import Cache +from yt_dlp.cache import Cache def _is_empty(d): diff --git a/test/test_compat.py b/test/test_compat.py index 20a7099d6..d903a5bfe 100644 --- a/test/test_compat.py +++ b/test/test_compat.py @@ -10,7 +10,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.compat import ( +from yt_dlp.compat import ( compat_getenv, compat_setenv, compat_etree_Element, @@ -30,11 +30,11 @@ from youtube_dlc.compat import ( class TestCompat(unittest.TestCase): def test_compat_getenv(self): test_str = 'тест' - compat_setenv('youtube_dlc_COMPAT_GETENV', test_str) - self.assertEqual(compat_getenv('youtube_dlc_COMPAT_GETENV'), test_str) + compat_setenv('yt_dlp_COMPAT_GETENV', test_str) + self.assertEqual(compat_getenv('yt_dlp_COMPAT_GETENV'), test_str) def test_compat_setenv(self): - test_var = 'youtube_dlc_COMPAT_SETENV' + test_var = 'yt_dlp_COMPAT_SETENV' test_str = 'тест' compat_setenv(test_var, test_str) compat_getenv(test_var) @@ -48,11 +48,11 @@ class TestCompat(unittest.TestCase): compat_setenv('HOME', old_home or '') def test_all_present(self): - import youtube_dlc.compat - all_names = youtube_dlc.compat.__all__ + import yt_dlp.compat + all_names = yt_dlp.compat.__all__ present_names = set(filter( lambda c: '_' in c and not c.startswith('_'), - dir(youtube_dlc.compat))) - set(['unicode_literals']) + dir(yt_dlp.compat))) - set(['unicode_literals']) self.assertEqual(all_names, sorted(present_names)) def test_compat_urllib_parse_quote(self): diff --git a/test/test_download.py b/test/test_download.py index bcd3b4041..5559b4d6f 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -24,24 +24,24 @@ import io import json import socket -import youtube_dlc.YoutubeDL -from youtube_dlc.compat import ( +import yt_dlp.YoutubeDL +from yt_dlp.compat import ( compat_http_client, compat_urllib_error, compat_HTTPError, ) -from youtube_dlc.utils import ( +from yt_dlp.utils import ( DownloadError, ExtractorError, format_bytes, UnavailableVideoError, ) -from youtube_dlc.extractor import get_info_extractor +from yt_dlp.extractor import get_info_extractor RETRIES = 3 -class YoutubeDL(youtube_dlc.YoutubeDL): +class YoutubeDL(yt_dlp.YoutubeDL): def __init__(self, *args, **kwargs): self.to_stderr = self.to_screen self.processed_info_dicts = [] @@ -92,7 +92,7 @@ class TestDownload(unittest.TestCase): def generator(test_case, tname): def test_template(self): - ie = youtube_dlc.extractor.get_info_extractor(test_case['name'])() + ie = yt_dlp.extractor.get_info_extractor(test_case['name'])() other_ies = [get_info_extractor(ie_key)() for ie_key in test_case.get('add_ie', [])] is_playlist = any(k.startswith('playlist') for k in test_case) test_cases = test_case.get( diff --git a/test/test_downloader_http.py b/test/test_downloader_http.py index c8e28bd3a..2ef96b922 100644 --- a/test/test_downloader_http.py +++ b/test/test_downloader_http.py @@ -10,10 +10,10 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import http_server_port, try_rm -from youtube_dlc import YoutubeDL -from youtube_dlc.compat import compat_http_server -from youtube_dlc.downloader.http import HttpFD -from youtube_dlc.utils import encodeFilename +from yt_dlp import YoutubeDL +from yt_dlp.compat import compat_http_server +from yt_dlp.downloader.http import HttpFD +from yt_dlp.utils import encodeFilename import threading TEST_DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/test/test_execution.py b/test/test_execution.py index b18e63d73..2aea4df1b 100644 --- a/test/test_execution.py +++ b/test/test_execution.py @@ -10,7 +10,7 @@ import os import subprocess sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.utils import encodeArgument +from yt_dlp.utils import encodeArgument rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -23,18 +23,18 @@ except AttributeError: class TestExecution(unittest.TestCase): def test_import(self): - subprocess.check_call([sys.executable, '-c', 'import youtube_dlc'], cwd=rootDir) + subprocess.check_call([sys.executable, '-c', 'import yt_dlp'], cwd=rootDir) def test_module_exec(self): if sys.version_info >= (2, 7): # Python 2.6 doesn't support package execution - subprocess.check_call([sys.executable, '-m', 'youtube_dlc', '--version'], cwd=rootDir, stdout=_DEV_NULL) + subprocess.check_call([sys.executable, '-m', 'yt_dlp', '--version'], cwd=rootDir, stdout=_DEV_NULL) def test_main_exec(self): - subprocess.check_call([sys.executable, 'youtube_dlc/__main__.py', '--version'], cwd=rootDir, stdout=_DEV_NULL) + subprocess.check_call([sys.executable, 'yt_dlp/__main__.py', '--version'], cwd=rootDir, stdout=_DEV_NULL) def test_cmdline_umlauts(self): p = subprocess.Popen( - [sys.executable, 'youtube_dlc/__main__.py', encodeArgument('ä'), '--version'], + [sys.executable, 'yt_dlp/__main__.py', encodeArgument('ä'), '--version'], cwd=rootDir, stdout=_DEV_NULL, stderr=subprocess.PIPE) _, stderr = p.communicate() self.assertFalse(stderr) diff --git a/test/test_http.py b/test/test_http.py index 55c3c6183..c9e7ee225 100644 --- a/test/test_http.py +++ b/test/test_http.py @@ -9,8 +9,8 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import http_server_port -from youtube_dlc import YoutubeDL -from youtube_dlc.compat import compat_http_server, compat_urllib_request +from yt_dlp import YoutubeDL +from yt_dlp.compat import compat_http_server, compat_urllib_request import ssl import threading diff --git a/test/test_iqiyi_sdk_interpreter.py b/test/test_iqiyi_sdk_interpreter.py index 303609baa..b39bf4270 100644 --- a/test/test_iqiyi_sdk_interpreter.py +++ b/test/test_iqiyi_sdk_interpreter.py @@ -9,7 +9,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL -from youtube_dlc.extractor import IqiyiIE +from yt_dlp.extractor import IqiyiIE class IqiyiIEWithCredentials(IqiyiIE): diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index 97fc8d5aa..def823884 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -8,7 +8,7 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.jsinterp import JSInterpreter +from yt_dlp.jsinterp import JSInterpreter class TestJSInterpreter(unittest.TestCase): diff --git a/test/test_netrc.py b/test/test_netrc.py index 566ba37a6..36b943591 100644 --- a/test/test_netrc.py +++ b/test/test_netrc.py @@ -7,7 +7,7 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.extractor import ( +from yt_dlp.extractor import ( gen_extractors, ) diff --git a/test/test_options.py b/test/test_options.py index dce253373..42d9183a9 100644 --- a/test/test_options.py +++ b/test/test_options.py @@ -8,7 +8,7 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.options import _hide_login_info +from yt_dlp.options import _hide_login_info class TestOptions(unittest.TestCase): diff --git a/test/test_overwrites.py b/test/test_overwrites.py index d5c866c83..41b4e6dea 100644 --- a/test/test_overwrites.py +++ b/test/test_overwrites.py @@ -23,7 +23,7 @@ class TestOverwrites(unittest.TestCase): def test_default_overwrites(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dlc/__main__.py', + sys.executable, 'yt_dlp/__main__.py', '-o', 'test.webm', 'https://www.youtube.com/watch?v=jNQXAC9IVRw' ], cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -35,7 +35,7 @@ class TestOverwrites(unittest.TestCase): def test_yes_overwrites(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dlc/__main__.py', '--yes-overwrites', + sys.executable, 'yt_dlp/__main__.py', '--yes-overwrites', '-o', 'test.webm', 'https://www.youtube.com/watch?v=jNQXAC9IVRw' ], cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/test/test_post_hooks.py b/test/test_post_hooks.py index 63500924e..51031871c 100644 --- a/test/test_post_hooks.py +++ b/test/test_post_hooks.py @@ -8,11 +8,11 @@ import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import get_params, try_rm -import youtube_dlc.YoutubeDL -from youtube_dlc.utils import DownloadError +import yt_dlp.YoutubeDL +from yt_dlp.utils import DownloadError -class YoutubeDL(youtube_dlc.YoutubeDL): +class YoutubeDL(yt_dlp.YoutubeDL): def __init__(self, *args, **kwargs): super(YoutubeDL, self).__init__(*args, **kwargs) self.to_stderr = self.to_screen diff --git a/test/test_postprocessors.py b/test/test_postprocessors.py index fabe7e6fb..2e9a1bf94 100644 --- a/test/test_postprocessors.py +++ b/test/test_postprocessors.py @@ -8,7 +8,7 @@ import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from youtube_dlc.postprocessor import MetadataFromFieldPP, MetadataFromTitlePP +from yt_dlp.postprocessor import MetadataFromFieldPP, MetadataFromTitlePP class TestMetadataFromField(unittest.TestCase): diff --git a/test/test_socks.py b/test/test_socks.py index be52e2343..8b4286982 100644 --- a/test/test_socks.py +++ b/test/test_socks.py @@ -15,7 +15,7 @@ from test.helper import ( FakeYDL, get_params, ) -from youtube_dlc.compat import ( +from yt_dlp.compat import ( compat_str, compat_urllib_request, ) diff --git a/test/test_subtitles.py b/test/test_subtitles.py index 0014d57b6..61547cdb1 100644 --- a/test/test_subtitles.py +++ b/test/test_subtitles.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL, md5 -from youtube_dlc.extractor import ( +from yt_dlp.extractor import ( YoutubeIE, DailymotionIE, TEDIE, diff --git a/test/test_swfinterp.py b/test/test_swfinterp.py index 1a8b353e8..29a390e42 100644 --- a/test/test_swfinterp.py +++ b/test/test_swfinterp.py @@ -14,7 +14,7 @@ import json import re import subprocess -from youtube_dlc.swfinterp import SWFInterpreter +from yt_dlp.swfinterp import SWFInterpreter TEST_DIR = os.path.join( diff --git a/test/test_update.py.disabled b/test/test_update.py.disabled index 1b144c43c..617aee2f8 100644 --- a/test/test_update.py.disabled +++ b/test/test_update.py.disabled @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import json -from youtube_dlc.update import rsa_verify +from yt_dlp.update import rsa_verify class TestUpdate(unittest.TestCase): diff --git a/test/test_utils.py b/test/test_utils.py index a0f78ebe1..795d2b46a 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -15,7 +15,7 @@ import io import json import xml.etree.ElementTree -from youtube_dlc.utils import ( +from yt_dlp.utils import ( age_restricted, args_to_str, encode_base_n, @@ -107,7 +107,7 @@ from youtube_dlc.utils import ( parse_codecs, iri_to_uri, ) -from youtube_dlc.compat import ( +from yt_dlp.compat import ( compat_chr, compat_etree_fromstring, compat_getenv, @@ -242,12 +242,12 @@ class TestUtil(unittest.TestCase): def env(var): return '%{0}%'.format(var) if sys.platform == 'win32' else '${0}'.format(var) - compat_setenv('youtube_dlc_EXPATH_PATH', 'expanded') - self.assertEqual(expand_path(env('youtube_dlc_EXPATH_PATH')), 'expanded') + compat_setenv('yt_dlp_EXPATH_PATH', 'expanded') + self.assertEqual(expand_path(env('yt_dlp_EXPATH_PATH')), 'expanded') self.assertEqual(expand_path(env('HOME')), compat_getenv('HOME')) self.assertEqual(expand_path('~'), compat_getenv('HOME')) self.assertEqual( - expand_path('~/%s' % env('youtube_dlc_EXPATH_PATH')), + expand_path('~/%s' % env('yt_dlp_EXPATH_PATH')), '%s/expanded' % compat_getenv('HOME')) def test_prepend_extension(self): @@ -1425,8 +1425,8 @@ Line 1 self.assertEqual(caesar('ebg', 'acegik', -2), 'abc') def test_rot47(self): - self.assertEqual(rot47('youtube-dlc'), r'J@FEF36\5=4') - self.assertEqual(rot47('YOUTUBE-DLC'), r'*~&%&qt\s{r') + self.assertEqual(rot47('yt-dlp'), r'JE\5=A') + self.assertEqual(rot47('YT-DLP'), r'*%\s{!') def test_urshift(self): self.assertEqual(urshift(3, 1), 1) diff --git a/test/test_verbose_output.py b/test/test_verbose_output.py index 462f25e03..9b1ccde88 100644 --- a/test/test_verbose_output.py +++ b/test/test_verbose_output.py @@ -17,7 +17,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_arg(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dlc/__main__.py', '-v', + sys.executable, 'yt_dlp/__main__.py', '-v', '--username', 'johnsmith@gmail.com', '--password', 'secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -30,7 +30,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_shortarg(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dlc/__main__.py', '-v', + sys.executable, 'yt_dlp/__main__.py', '-v', '-u', 'johnsmith@gmail.com', '-p', 'secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -43,7 +43,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_eq(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dlc/__main__.py', '-v', + sys.executable, 'yt_dlp/__main__.py', '-v', '--username=johnsmith@gmail.com', '--password=secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -56,7 +56,7 @@ class TestVerboseOutput(unittest.TestCase): def test_private_info_shortarg_eq(self): outp = subprocess.Popen( [ - sys.executable, 'youtube_dlc/__main__.py', '-v', + sys.executable, 'yt_dlp/__main__.py', '-v', '-u=johnsmith@gmail.com', '-p=secret', ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/test/test_write_annotations.py b/test/test_write_annotations.py index d98c96c15..3a0122374 100644 --- a/test/test_write_annotations.py +++ b/test/test_write_annotations.py @@ -15,11 +15,11 @@ import io import xml.etree.ElementTree -import youtube_dlc.YoutubeDL -import youtube_dlc.extractor +import yt_dlp.YoutubeDL +import yt_dlp.extractor -class YoutubeDL(youtube_dlc.YoutubeDL): +class YoutubeDL(yt_dlp.YoutubeDL): def __init__(self, *args, **kwargs): super(YoutubeDL, self).__init__(*args, **kwargs) self.to_stderr = self.to_screen @@ -45,7 +45,7 @@ class TestAnnotations(unittest.TestCase): def test_info_json(self): expected = list(EXPECTED_ANNOTATIONS) # Two annotations could have the same text. - ie = youtube_dlc.extractor.YoutubeIE() + ie = yt_dlp.extractor.YoutubeIE() ydl = YoutubeDL(params) ydl.add_info_extractor(ie) ydl.download([TEST_ID]) diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py index d9b8fa550..b38a47fc5 100644 --- a/test/test_youtube_lists.py +++ b/test/test_youtube_lists.py @@ -10,7 +10,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL -from youtube_dlc.extractor import ( +from yt_dlp.extractor import ( YoutubePlaylistIE, YoutubeTabIE, YoutubeIE, diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index 268518591..80cb4b93a 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -13,8 +13,8 @@ import re import string from test.helper import FakeYDL -from youtube_dlc.extractor import YoutubeIE -from youtube_dlc.compat import compat_str, compat_urlretrieve +from yt_dlp.extractor import YoutubeIE +from yt_dlp.compat import compat_str, compat_urlretrieve _TESTS = [ ( |