Skip to content

Commit 998d703

Browse files
committed
Test proxy
1 parent 19f7535 commit 998d703

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/functional/test_proxy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ssl
22
from pathlib import Path
3-
from typing import Any, Dict, Optional
3+
from typing import Any, Dict
44

55
import proxy
66
import pytest
@@ -17,18 +17,18 @@
1717

1818

1919
class AccessLogPlugin(HttpProxyBasePlugin):
20-
def on_access_log(self, context: Dict[str, Any]) -> Optional[Dict[str, Any]]:
20+
def on_access_log(self, context: Dict[str, Any]) -> None:
2121
print(context)
22-
return super().on_access_log(context)
2322

2423

2524
@pytest.mark.network
2625
def test_proxy_overrides_env(script: PipTestEnvironment) -> None:
2726
with proxy.Proxy(
2827
port=8899,
29-
), proxy.Proxy(plugins=[AccessLogPlugin], port=8888):
30-
script.environ["http_proxy"] = "127:0.0.1:8888"
31-
script.environ["https_proxy"] = "127:0.0.1:8888"
28+
num_acceptors=1,
29+
), proxy.Proxy(plugins=[AccessLogPlugin], port=8888, num_acceptors=1):
30+
script.environ["http_proxy"] = "127.0.0.1:8888"
31+
script.environ["https_proxy"] = "127.0.0.1:8888"
3232
result = script.pip(
3333
"download",
3434
"--proxy",
@@ -69,7 +69,7 @@ def test_proxy_does_not_override_netrc(
6969

7070
netrc = script.scratch_path / ".netrc"
7171
netrc.write_text(f"machine {server.host} login USERNAME password PASSWORD")
72-
with proxy.Proxy(port=8888), server_running(server):
72+
with proxy.Proxy(port=8888, num_acceptors=1), server_running(server):
7373
script.environ["NETRC"] = netrc
7474
script.pip(
7575
"install",

0 commit comments

Comments
 (0)