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
Provenance
- Commit
0a38695- Tree
f818bda- Author
cdeler <serj.krotov@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
7123b0f
3 files changed+9 added−8 removed
modified:httpx/_client.py+2 added-1 removed
105 unmodified lines106 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}111 112 @property113 def timeout(self) -> Timeout:114 return self._timeout918 unmodified lines1033 transport=transport,1034 app=app,1035 trust_env=trust_env,1036 )1037+1038 self._proxies: typing.Dict[1039 URLPattern, typing.Optional[httpcore.AsyncHTTPTransport]1040 ] = {1041 URLPattern(key): None487 unmodified linesmodified:httpx/_utils.py+3 added-1 removed
310 unmodified lines311 312 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+ )318 319 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 details228 unmodified linesmodified:tests/test_utils.py+4 added-6 removed
190 unmodified lines191 @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 )204 def test_get_environment_proxies(environment, proxies):41 unmodified lines246 ("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 )254 def test_url_matches(pattern, url, expected):18 unmodified lines