aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_YoutubeDL.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_YoutubeDL.py')
-rw-r--r--test/test_YoutubeDL.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 15ad15115..1153881e9 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -8,15 +8,11 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import copy
import json
-from test.helper import FakeYDL, assertRegexpMatches
+import urllib.error
+from test.helper import FakeYDL, assertRegexpMatches
from yt_dlp import YoutubeDL
-from yt_dlp.compat import (
- compat_os_name,
- compat_setenv,
- compat_str,
- compat_urllib_error,
-)
+from yt_dlp.compat import compat_os_name, compat_str
from yt_dlp.extractor import YoutubeIE
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.postprocessor.common import PostProcessor
@@ -841,14 +837,14 @@ class TestYoutubeDL(unittest.TestCase):
# test('%(foo|)s', ('', '_')) # fixme
# Environment variable expansion for prepare_filename
- compat_setenv('__yt_dlp_var', 'expanded')
+ os.environ['__yt_dlp_var'] = 'expanded'
envvar = '%__yt_dlp_var%' if compat_os_name == 'nt' else '$__yt_dlp_var'
test(envvar, (envvar, 'expanded'))
if compat_os_name == 'nt':
test('%s%', ('%s%', '%s%'))
- compat_setenv('s', 'expanded')
+ os.environ['s'] = 'expanded'
test('%s%', ('%s%', 'expanded')) # %s% should be expanded before escaping %s
- compat_setenv('(test)s', 'expanded')
+ os.environ['(test)s'] = 'expanded'
test('%(test)s%', ('NA%', 'expanded')) # Environment should take priority over template
# Path expansion and escaping
@@ -1101,7 +1097,7 @@ class TestYoutubeDL(unittest.TestCase):
def test_urlopen_no_file_protocol(self):
# see https://github.com/ytdl-org/youtube-dl/issues/8227
ydl = YDL()
- self.assertRaises(compat_urllib_error.URLError, ydl.urlopen, 'file:///etc/passwd')
+ self.assertRaises(urllib.error.URLError, ydl.urlopen, 'file:///etc/passwd')
def test_do_not_override_ie_key_in_url_transparent(self):
ydl = YDL()