mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
584 B
Python
22 lines
584 B
Python
1 year ago
|
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)
|