|
1 | 1 | import ssl
|
2 | 2 | from pathlib import Path
|
3 |
| -from typing import Any, Dict, Optional |
| 3 | +from typing import Any, Dict |
4 | 4 |
|
5 | 5 | import proxy
|
6 | 6 | import pytest
|
|
17 | 17 |
|
18 | 18 |
|
19 | 19 | 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: |
21 | 21 | print(context)
|
22 |
| - return super().on_access_log(context) |
23 | 22 |
|
24 | 23 |
|
25 | 24 | @pytest.mark.network
|
26 | 25 | def test_proxy_overrides_env(script: PipTestEnvironment) -> None:
|
27 | 26 | with proxy.Proxy(
|
28 | 27 | 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" |
32 | 32 | result = script.pip(
|
33 | 33 | "download",
|
34 | 34 | "--proxy",
|
@@ -69,7 +69,7 @@ def test_proxy_does_not_override_netrc(
|
69 | 69 |
|
70 | 70 | netrc = script.scratch_path / ".netrc"
|
71 | 71 | 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): |
73 | 73 | script.environ["NETRC"] = netrc
|
74 | 74 | script.pip(
|
75 | 75 | "install",
|
|
0 commit comments