aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_InfoExtractor.py1
-rw-r--r--test/test_YoutubeDL.py2
-rw-r--r--test/test_YoutubeDLCookieJar.py8
-rw-r--r--test/test_aes.py2
-rw-r--r--test/test_age_restriction.py3
-rw-r--r--test/test_all_urls.py5
-rw-r--r--test/test_cache.py5
-rw-r--r--test/test_compat.py1
-rwxr-xr-xtest/test_download.py4
-rw-r--r--test/test_downloader_http.py5
-rw-r--r--test/test_execution.py8
-rw-r--r--test/test_http.py5
-rw-r--r--test/test_iqiyi_sdk_interpreter.py3
-rw-r--r--test/test_jsinterp.py2
-rw-r--r--test/test_netrc.py3
-rw-r--r--test/test_overwrites.py6
-rw-r--r--test/test_post_hooks.py6
-rw-r--r--test/test_postprocessors.py2
-rw-r--r--test/test_socks.py2
-rw-r--r--test/test_subtitles.py1
-rw-r--r--test/test_update.py.disabled1
-rw-r--r--test/test_utils.py4
-rw-r--r--test/test_verbose_output.py6
-rw-r--r--test/test_write_annotations.py.disabled4
-rw-r--r--test/test_youtube_lists.py3
-rw-r--r--test/test_youtube_misc.py1
-rw-r--r--test/test_youtube_signature.py6
27 files changed, 74 insertions, 25 deletions
diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py
index f0571c41a..f57a29ffc 100644
--- a/test/test_InfoExtractor.py
+++ b/test/test_InfoExtractor.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 1153881e9..44e8f2917 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,6 +7,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
import copy
import json
import urllib.error
diff --git a/test/test_YoutubeDLCookieJar.py b/test/test_YoutubeDLCookieJar.py
index 6280e1f2c..0d4e7dc97 100644
--- a/test/test_YoutubeDLCookieJar.py
+++ b/test/test_YoutubeDLCookieJar.py
@@ -1,12 +1,16 @@
#!/usr/bin/env python3
+
+# Allow direct execution
import os
-import re
import sys
-import tempfile
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import re
+import tempfile
+
from yt_dlp.utils import YoutubeDLCookieJar
diff --git a/test/test_aes.py b/test/test_aes.py
index 2b7b7cf54..037246588 100644
--- a/test/test_aes.py
+++ b/test/test_aes.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,6 +7,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
import base64
from yt_dlp.aes import (
diff --git a/test/test_age_restriction.py b/test/test_age_restriction.py
index e1012f69b..ff248432b 100644
--- a/test/test_age_restriction.py
+++ b/test/test_age_restriction.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,8 +7,8 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import is_download_test, try_rm
+from test.helper import is_download_test, try_rm
from yt_dlp import YoutubeDL
diff --git a/test/test_all_urls.py b/test/test_all_urls.py
index b6019554e..848c96ff0 100644
--- a/test/test_all_urls.py
+++ b/test/test_all_urls.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
+
# Allow direct execution
-import collections
import os
import sys
import unittest
@@ -8,8 +8,9 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import gettestcases
+import collections
+from test.helper import gettestcases
from yt_dlp.extractor import FacebookIE, YoutubeIE, gen_extractors
diff --git a/test/test_cache.py b/test/test_cache.py
index 14e54ba20..ce1624b68 100644
--- a/test/test_cache.py
+++ b/test/test_cache.py
@@ -1,15 +1,16 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
-import shutil
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import FakeYDL
+import shutil
+from test.helper import FakeYDL
from yt_dlp.cache import Cache
diff --git a/test/test_compat.py b/test/test_compat.py
index 62bf5a306..a70adfa30 100644
--- a/test/test_compat.py
+++ b/test/test_compat.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
diff --git a/test/test_download.py b/test/test_download.py
index b82f174bb..b98ddebcb 100755
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -8,10 +9,10 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import hashlib
+import http.client
import json
import socket
import urllib.error
-import http.client
from test.helper import (
assertGreaterEqual,
@@ -23,6 +24,7 @@ from test.helper import (
report_warning,
try_rm,
)
+
import yt_dlp.YoutubeDL # isort: split
from yt_dlp.compat import compat_HTTPError
from yt_dlp.extractor import get_info_extractor
diff --git a/test/test_downloader_http.py b/test/test_downloader_http.py
index dac770758..cce7c59e2 100644
--- a/test/test_downloader_http.py
+++ b/test/test_downloader_http.py
@@ -1,17 +1,18 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
import unittest
-import http.server
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+import http.server
import re
import threading
-from test.helper import http_server_port, try_rm
+from test.helper import http_server_port, try_rm
from yt_dlp import YoutubeDL
from yt_dlp.downloader.http import HttpFD
from yt_dlp.utils import encodeFilename
diff --git a/test/test_execution.py b/test/test_execution.py
index 6efd432e9..1d15fddab 100644
--- a/test/test_execution.py
+++ b/test/test_execution.py
@@ -1,12 +1,16 @@
#!/usr/bin/env python3
-import contextlib
+
+# Allow direct execution
import os
-import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import contextlib
+import subprocess
+
from yt_dlp.utils import encodeArgument
rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/test/test_http.py b/test/test_http.py
index 828797ec7..b1aac7720 100644
--- a/test/test_http.py
+++ b/test/test_http.py
@@ -1,18 +1,19 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
import unittest
-import http.server
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+import http.server
import ssl
import threading
import urllib.request
-from test.helper import http_server_port
+from test.helper import http_server_port
from yt_dlp import YoutubeDL
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
diff --git a/test/test_iqiyi_sdk_interpreter.py b/test/test_iqiyi_sdk_interpreter.py
index 4b82b7187..47c632a4e 100644
--- a/test/test_iqiyi_sdk_interpreter.py
+++ b/test/test_iqiyi_sdk_interpreter.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,8 +7,8 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import FakeYDL, is_download_test
+from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import IqiyiIE
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index 872c58c8f..4277cabe0 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,6 +7,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
from yt_dlp.jsinterp import JSInterpreter
diff --git a/test/test_netrc.py b/test/test_netrc.py
index f7a0b33d2..dc708d974 100644
--- a/test/test_netrc.py
+++ b/test/test_netrc.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python3
+
+# Allow direct execution
import os
import sys
import unittest
diff --git a/test/test_overwrites.py b/test/test_overwrites.py
index a6d5bae40..6954c07f9 100644
--- a/test/test_overwrites.py
+++ b/test/test_overwrites.py
@@ -1,11 +1,15 @@
#!/usr/bin/env python3
+
+# Allow direct execution
import os
-import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import subprocess
+
from test.helper import is_download_test, try_rm
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/test/test_post_hooks.py b/test/test_post_hooks.py
index e84a08f29..3778d1794 100644
--- a/test/test_post_hooks.py
+++ b/test/test_post_hooks.py
@@ -1,13 +1,15 @@
#!/usr/bin/env python3
+
+# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import get_params, is_download_test, try_rm
-import yt_dlp.YoutubeDL
+from test.helper import get_params, is_download_test, try_rm
+import yt_dlp.YoutubeDL # isort: split
from yt_dlp.utils import DownloadError
diff --git a/test/test_postprocessors.py b/test/test_postprocessors.py
index 9d8a4dcc5..c49e3ede0 100644
--- a/test/test_postprocessors.py
+++ b/test/test_postprocessors.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,6 +7,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_shlex_quote
from yt_dlp.postprocessor import (
diff --git a/test/test_socks.py b/test/test_socks.py
index 0b8e03a9f..159faf58e 100644
--- a/test/test_socks.py
+++ b/test/test_socks.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,6 +7,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
import random
import subprocess
import urllib.request
diff --git a/test/test_subtitles.py b/test/test_subtitles.py
index 5120f83e2..57362895f 100644
--- a/test/test_subtitles.py
+++ b/test/test_subtitles.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
diff --git a/test/test_update.py.disabled b/test/test_update.py.disabled
index 73b55cdac..85ac86692 100644
--- a/test/test_update.py.disabled
+++ b/test/test_update.py.disabled
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
diff --git a/test/test_utils.py b/test/test_utils.py
index 38647adb4..8024a8e7c 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
+
# Allow direct execution
-import contextlib
import os
import sys
import unittest
@@ -8,7 +8,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-# Various small unit tests
+import contextlib
import io
import itertools
import json
diff --git a/test/test_verbose_output.py b/test/test_verbose_output.py
index 657994074..21ce10a1f 100644
--- a/test/test_verbose_output.py
+++ b/test/test_verbose_output.py
@@ -1,11 +1,15 @@
#!/usr/bin/env python3
+
+# Allow direct execution
import os
-import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import subprocess
+
rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/test/test_write_annotations.py.disabled b/test/test_write_annotations.py.disabled
index cca60561f..c7cf199f6 100644
--- a/test/test_write_annotations.py.disabled
+++ b/test/test_write_annotations.py.disabled
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,11 +7,12 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
import xml.etree.ElementTree
-from test.helper import get_params, is_download_test, try_rm
import yt_dlp.extractor
import yt_dlp.YoutubeDL
+from test.helper import get_params, is_download_test, try_rm
class YoutubeDL(yt_dlp.YoutubeDL):
diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py
index 66611e236..c2dd0ac30 100644
--- a/test/test_youtube_lists.py
+++ b/test/test_youtube_lists.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
@@ -6,8 +7,8 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from test.helper import FakeYDL, is_download_test
+from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import YoutubeIE, YoutubeTabIE
diff --git a/test/test_youtube_misc.py b/test/test_youtube_misc.py
index 36f8be689..81be5d3c9 100644
--- a/test/test_youtube_misc.py
+++ b/test/test_youtube_misc.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
# Allow direct execution
import os
import sys
diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py
index 2c2013295..56304772b 100644
--- a/test/test_youtube_signature.py
+++ b/test/test_youtube_signature.py
@@ -1,17 +1,19 @@
#!/usr/bin/env python3
+
# Allow direct execution
-import contextlib
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import contextlib
import re
import string
import urllib.request
-from test.helper import FakeYDL, is_download_test
+from test.helper import FakeYDL, is_download_test
from yt_dlp.compat import compat_str
from yt_dlp.extractor import YoutubeIE
from yt_dlp.jsinterp import JSInterpreter