]> jfr.im git - yt-dlp.git/blobdiff - test/test_socks.py
[test:download] Raise on network errors (#10283)
[yt-dlp.git] / test / test_socks.py
index 43d612d85d17f01f68033010c719fb049133a3fe..68af19d0ca449d726da43447f8619ce53a82b39a 100644 (file)
@@ -95,7 +95,7 @@ def handle(self):
             return
 
         elif Socks5Auth.AUTH_USER_PASS in methods:
-            self.connection.sendall(struct.pack("!BB", SOCKS5_VERSION, Socks5Auth.AUTH_USER_PASS))
+            self.connection.sendall(struct.pack('!BB', SOCKS5_VERSION, Socks5Auth.AUTH_USER_PASS))
 
             _, user_len = struct.unpack('!BB', self.connection.recv(2))
             username = self.connection.recv(user_len).decode()
@@ -174,7 +174,7 @@ def handle(self):
         if 0x0 < dest_ip <= 0xFF:
             use_remote_dns = True
         else:
-            socks_info['ipv4_address'] = socket.inet_ntoa(struct.pack("!I", dest_ip))
+            socks_info['ipv4_address'] = socket.inet_ntoa(struct.pack('!I', dest_ip))
 
         user_id = self._read_until_null().decode()
         if user_id != (self.socks_kwargs.get('user_id') or ''):
@@ -291,7 +291,7 @@ def ctx(request):
         ('Urllib', 'http'),
         ('Requests', 'http'),
         ('Websockets', 'ws'),
-        ('CurlCFFI', 'http')
+        ('CurlCFFI', 'http'),
     ], indirect=True)
 class TestSocks4Proxy:
     def test_socks4_no_auth(self, handler, ctx):
@@ -366,7 +366,7 @@ def test_timeout(self, handler, ctx):
         ('Urllib', 'http'),
         ('Requests', 'http'),
         ('Websockets', 'ws'),
-        ('CurlCFFI', 'http')
+        ('CurlCFFI', 'http'),
     ], indirect=True)
 class TestSocks5Proxy: