diff options
author | coletdjnz <coletdjnz@protonmail.com> | 2024-01-20 10:39:49 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-20 10:39:49 +1300 |
commit | 69d31914952dd33082ac7019c6f76b43c45b9d06 (patch) | |
tree | 03d8366814564c84f349207939abb6d39c104114 /test/helper.py | |
parent | 50e06e21a68e336198198bda332b8e7d2314f201 (diff) |
[test] Skip source address tests if the address cannot be bound to (#8900)
Fixes https://github.com/yt-dlp/yt-dlp/issues/8890
Authored by: coletdjnz
Diffstat (limited to 'test/helper.py')
-rw-r--r-- | test/helper.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/helper.py b/test/helper.py index e5ace8fe2..4aca47025 100644 --- a/test/helper.py +++ b/test/helper.py @@ -10,7 +10,7 @@ import types import yt_dlp.extractor from yt_dlp import YoutubeDL from yt_dlp.compat import compat_os_name -from yt_dlp.utils import preferredencoding, try_call, write_string +from yt_dlp.utils import preferredencoding, try_call, write_string, find_available_port if 'pytest' in sys.modules: import pytest @@ -329,3 +329,8 @@ def http_server_port(httpd): else: sock = httpd.socket return sock.getsockname()[1] + + +def verify_address_availability(address): + if find_available_port(address) is None: + pytest.skip(f'Unable to bind to source address {address} (address may not exist)') |