diff options
| author | dirkf <fieldhouse@gmx.net> | 2023-07-13 20:14:50 +0100 | 
|---|---|---|
| committer | dirkf <fieldhouse@gmx.net> | 2023-07-18 10:50:46 +0100 | 
| commit | 1d8d5a93f7187438587c3a754b53fdf30322cef0 (patch) | |
| tree | 742e29d44245efcb5db44a0a5e70b5c9675c4074 /test/test_http.py | |
| parent | 1634b1d61efa36c31c86b8c64c88dc297a7af28a (diff) | |
[test] Fixes for old Pythons
Diffstat (limited to 'test/test_http.py')
| -rw-r--r-- | test/test_http.py | 7 | 
1 files changed, 6 insertions, 1 deletions
| diff --git a/test/test_http.py b/test/test_http.py index cd180b51f..1a6b2e878 100644 --- a/test/test_http.py +++ b/test/test_http.py @@ -8,6 +8,7 @@ import sys  import unittest  sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +import contextlib  import gzip  import io  import ssl @@ -154,7 +155,7 @@ class HTTPTestRequestHandler(compat_http_server.BaseHTTPRequestHandler):          def gzip_compress(p):              buf = io.BytesIO() -            with gzip.GzipFile(fileobj=buf, mode='wb') as f: +            with contextlib.closing(gzip.GzipFile(fileobj=buf, mode='wb')) as f:                  f.write(p)              return buf.getvalue() @@ -306,6 +307,10 @@ class TestHTTP(unittest.TestCase):              else self.https_port if scheme == 'https'              else self.http_port, path) +    @unittest.skipUnless( +        sys.version_info >= (3, 2) +        or (sys.version_info[0] == 2 and sys.version_info[1:] >= (7, 9)), +        'No support for certificate check in SSL')      def test_nocheckcertificate(self):          with FakeYDL({'logger': FakeLogger()}) as ydl:              with self.assertRaises(compat_urllib_error.URLError): | 
