aboutsummaryrefslogtreecommitdiffstats
path: root/test/conftest.py
diff options
context:
space:
mode:
authorcoletdjnz <coletdjnz@protonmail.com>2023-08-25 07:10:44 +0000
committerGitHub <noreply@github.com>2023-08-25 07:10:44 +0000
commitfcd6a76adc49d5cd8783985c7ce35384b72e545f (patch)
tree86458e2871946d905adbf7daa83e02baf9186980 /test/conftest.py
parent7cccab79e7d00ed965b48b8cefce1da8a0513409 (diff)
downloadhypervideo-pre-fcd6a76adc49d5cd8783985c7ce35384b72e545f.tar.lz
hypervideo-pre-fcd6a76adc49d5cd8783985c7ce35384b72e545f.tar.xz
hypervideo-pre-fcd6a76adc49d5cd8783985c7ce35384b72e545f.zip
[tests] Add tests for socks proxies (#7908)
Authored by: coletdjnz
Diffstat (limited to 'test/conftest.py')
-rw-r--r--test/conftest.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/conftest.py b/test/conftest.py
new file mode 100644
index 000000000..15549d30b
--- /dev/null
+++ b/test/conftest.py
@@ -0,0 +1,21 @@
+import functools
+import inspect
+
+import pytest
+
+from yt_dlp.networking import RequestHandler
+from yt_dlp.networking.common import _REQUEST_HANDLERS
+from yt_dlp.utils._utils import _YDLLogger as FakeLogger
+
+
+@pytest.fixture
+def handler(request):
+ RH_KEY = request.param
+ if inspect.isclass(RH_KEY) and issubclass(RH_KEY, RequestHandler):
+ handler = RH_KEY
+ elif RH_KEY in _REQUEST_HANDLERS:
+ handler = _REQUEST_HANDLERS[RH_KEY]
+ else:
+ pytest.skip(f'{RH_KEY} request handler is not available')
+
+ return functools.partial(handler, logger=FakeLogger)