Skip to content
Myr

Fixed warnings in unit tests suite, caused by #1127 PR (#1137)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by cdeler · committed by GitHub · parent 7123b0f · Browse files · 3 files+9 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+9 added−8 removed

  • tests:+4 added−6 removed
  • other:+5 added−2 removed

3 files+9 added−8 removed

modified:httpx/_client.py+2 added-1 removed
105 unmodified lines
106 new_proxies[str(key)] = proxy107 return new_proxies108 else:109 proxy = Proxy(url=proxies) if isinstance(proxies, (str, URL)) else proxies110 return {"all": proxy}110 return {"all://": proxy}111112 @property113 def timeout(self) -> Timeout:114 return self._timeout
918 unmodified lines
1033 transport=transport,1034 app=app,1035 trust_env=trust_env,1036 )10371038 self._proxies: typing.Dict[1039 URLPattern, typing.Optional[httpcore.AsyncHTTPTransport]1040 ] = {1041 URLPattern(key): None
487 unmodified lines
modified:httpx/_utils.py+3 added-1 removed
310 unmodified lines
311312 for scheme in ("http", "https", "all"):313 if proxy_info.get(scheme):314 hostname = proxy_info[scheme]315 mounts[f"{scheme}://"] = (315 mounts[scheme] = hostname if "://" in hostname else f"http://{hostname}"316 hostname if "://" in hostname else f"http://{hostname}"317 )318319 no_proxy_hosts = [host.strip() for host in proxy_info.get("no", "").split(",")]320 for hostname in no_proxy_hosts:321 # See https://curl.haxx.se/libcurl/c/CURLOPT_NOPROXY.html for details
228 unmodified lines
modified:tests/test_utils.py+4 added-6 removed
190 unmodified lines
191@pytest.mark.parametrize(192 ["environment", "proxies"],193 [194 ({}, {}),195 ({"HTTP_PROXY": "http://127.0.0.1"}, {"http": "http://127.0.0.1"}),195 ({"HTTP_PROXY": "http://127.0.0.1"}, {"http://": "http://127.0.0.1"}),196 (197 {"https_proxy": "http://127.0.0.1", "HTTP_PROXY": "https://127.0.0.1"},198 {"https": "http://127.0.0.1", "http": "https://127.0.0.1"},198 {"https://": "http://127.0.0.1", "http://": "https://127.0.0.1"},199 ),200 ({"all_proxy": "http://127.0.0.1"}, {"all": "http://127.0.0.1"}),200 ({"all_proxy": "http://127.0.0.1"}, {"all://": "http://127.0.0.1"}),201 ({"TRAVIS_APT_PROXY": "http://127.0.0.1"}, {}),202 ],203)204def test_get_environment_proxies(environment, proxies):
41 unmodified lines
246 ("all://example.com", "http://example.com", True,),247 ("all://example.com", "https://example.com", True,),248 ("http://", "http://example.com", True,),249 ("http://", "https://example.com", False,),250 ("http", "http://example.com", True,),251 ("http", "https://example.com", False,),252 ("all", "https://example.com:123", True,),250 ("all://", "https://example.com:123", True,),251 ("", "https://example.com:123", True,),252 ],253)254def test_url_matches(pattern, url, expected):
18 unmodified lines