Skip to content

Commit 15ad8cd

Browse files
committed
fix test_debuglevel for 3.11 and lower
1 parent e14b595 commit 15ad8cd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/with_dummyserver/test_socketlevel.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import shutil
1313
import socket
1414
import ssl
15+
import sys
1516
import tempfile
1617
import typing
1718
import zlib
@@ -1346,11 +1347,17 @@ def http_socket_handler(listener: socket.socket) -> None:
13461347
with pytest.raises(MaxRetryError):
13471348
proxy.request("GET", "https://example.com", retries=0)
13481349

1349-
assert capsys.readouterr().out == (
1350-
"send: b'CONNECT example.com:443 HTTP/1.1\\r\\n"
1351-
"Host: example.com:443\\r\\n\\r\\n'"
1352-
"\nheader: Example-Header: Example-Value\r\n\n"
1353-
)
1350+
if sys.version_info >= (3, 12):
1351+
assert capsys.readouterr().out == (
1352+
"send: b'CONNECT example.com:443 HTTP/1.1\\r\\n"
1353+
"Host: example.com:443\\r\\n\\r\\n'"
1354+
"\nheader: Example-Header: Example-Value\r\n\nheader: \r\n\n"
1355+
)
1356+
else:
1357+
assert capsys.readouterr().out == (
1358+
"send: b'CONNECT example.com:443 HTTP/1.0\\r\\n\\r\\n'"
1359+
"\nheader: Example-Header: Example-Value\r\n\n"
1360+
)
13541361

13551362

13561363
class TestSSL(SocketDummyServerTestCase):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy