Skip to content

Commit 1fdf3e6

Browse files
committed
Disable socket test on windows
1 parent 9fc0b59 commit 1fdf3e6

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

tests/resources/httpinfo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55
import argparse
66
import socket
7+
import sys
78
from http.server import BaseHTTPRequestHandler, HTTPServer
89
from pathlib import Path
910

@@ -28,8 +29,10 @@ def address_string(self):
2829
return super().address_string()
2930

3031

31-
class HTTPUnixServer(HTTPServer):
32-
address_family = socket.AF_UNIX
32+
if sys.platform != "win32":
33+
34+
class HTTPUnixServer(HTTPServer):
35+
address_family = socket.AF_UNIX
3336

3437

3538
if __name__ == "__main__":

tests/test_proxies.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import gzip
33
import json
4+
import sys
45
from http.client import HTTPConnection
56
from io import BytesIO
67
from typing import Tuple
@@ -23,15 +24,30 @@ def request_get(port, path, token, host=LOCALHOST):
2324
return h.getresponse()
2425

2526

26-
@pytest.mark.parametrize(
27-
"server_process_path",
28-
[
29-
"/python-http/",
27+
PARAMETERIZED_SERVER_PROCESS_PATHS = [
28+
"/python-http/",
29+
pytest.param(
3030
"/python-unix-socket-true/",
31+
marks=pytest.mark.skipif(
32+
sys.platform == "win32", reason="Unix socket not supported on Windows"
33+
),
34+
),
35+
pytest.param(
3136
"/python-unix-socket-file/",
37+
marks=pytest.mark.skipif(
38+
sys.platform == "win32", reason="Unix socket not supported on Windows"
39+
),
40+
),
41+
pytest.param(
3242
"/python-unix-socket-file-no-command/",
33-
],
34-
)
43+
marks=pytest.mark.skipif(
44+
sys.platform == "win32", reason="Unix socket not supported on Windows"
45+
),
46+
),
47+
]
48+
49+
50+
@pytest.mark.parametrize("server_process_path", PARAMETERIZED_SERVER_PROCESS_PATHS)
3551
def test_server_proxy_minimal_proxy_path_encoding(
3652
server_process_path: str, a_server_port_and_token: Tuple[int, str]
3753
) -> None:
@@ -50,15 +66,7 @@ def test_server_proxy_minimal_proxy_path_encoding(
5066
assert f"GET /{special_path}&token=" in s
5167

5268

53-
@pytest.mark.parametrize(
54-
"server_process_path",
55-
[
56-
"/python-http/",
57-
"/python-unix-socket-true/",
58-
"/python-unix-socket-file/",
59-
"/python-unix-socket-file-no-command/",
60-
],
61-
)
69+
@pytest.mark.parametrize("server_process_path", PARAMETERIZED_SERVER_PROCESS_PATHS)
6270
def test_server_proxy_hash_sign_encoding(
6371
server_process_path: str, a_server_port_and_token: Tuple[int, str]
6472
) -> None:

0 commit comments

Comments
 (0)