X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=test%2Fhelper.py;h=aa9a1c9b2aadcd3a9eaeb1170c2e8d90afabb0b8;hb=95e42d7336d01f505d6551a21df52f3ae234e96b;hp=dfee217a9b8acb64e426c3ce8fc5c11a9c5a0121;hpb=4315f74fa8e97ca1fdd1fe919f777b3942da2028;p=youtube-dl diff --git a/test/helper.py b/test/helper.py index dfee217a9..aa9a1c9b2 100644 --- a/test/helper.py +++ b/test/helper.py @@ -7,6 +7,7 @@ import json import os.path import re import types +import ssl import sys import youtube_dl.extractor @@ -244,3 +245,12 @@ def expect_warnings(ydl, warnings_re): real_warning(w) ydl.report_warning = _report_warning + + +def http_server_port(httpd): + if os.name == 'java' and isinstance(httpd.socket, ssl.SSLSocket): + # In Jython SSLSocket is not a subclass of socket.socket + sock = httpd.socket.sock + else: + sock = httpd.socket + return sock.getsockname()[1]