tests/test_main.py::test_verbose and ::test_auth fail with click==8.2.0
#3572
-
|
When running the test suite with ========================================================= test session starts =========================================================
platform linux -- Python 3.13.3, pytest-8.3.4, pluggy-1.5.0 -- /tmp/httpx/.venv/bin/python3
cachedir: .pytest_cache
rootdir: /tmp/httpx
configfile: pyproject.toml
plugins: anyio-4.9.0
collected 1418 items
[...]
============================================================== FAILURES ===============================================================
____________________________________________________________ test_verbose _____________________________________________________________
server = <tests.conftest.TestServer object at 0x7f3b285b06e0>
def test_verbose(server):
url = str(server.url)
runner = CliRunner()
result = runner.invoke(httpx.main, [url, "-v"])
assert result.exit_code == 0
> assert remove_date_header(splitlines(result.output)) == [
"* Connecting to '127.0.0.1'",
"* Connected to '127.0.0.1' on port 8000",
"GET / HTTP/1.1",
f"Host: {server.url.netloc.decode('ascii')}",
"Accept: */*",
"Accept-Encoding: gzip, deflate, br, zstd",
"Connection: keep-alive",
f"User-Agent: python-httpx/{httpx.__version__}",
"",
"HTTP/1.1 200 OK",
"server: uvicorn",
"content-type: text/plain",
"Transfer-Encoding: chunked",
"",
"Hello, world!",
]
E assert ['HTTP/1.1 200 OK', 'server: uvicorn', 'content-type: text/plain', 'Transfer-Encoding: chunked', '', 'Hello, world!'] == ["* Connecting to '127.0.0.1'", "* Connected to '127.0.0.1' on port 8000", 'GET / HTTP/1.1', 'Host: 127.0.0.1:8000', 'Accept: */*', 'Accept-Encoding: gzip, deflate, br, zstd', 'Connection: keep-alive', 'User-Agent: python-httpx/0.28.1', '', 'HTTP/1.1 200 OK', 'server: uvicorn', 'content-type: text/plain', 'Transfer-Encoding: chunked', '', 'Hello, world!']
E
E At index 0 diff: 'HTTP/1.1 200 OK' != "* Connecting to '127.0.0.1'"
E Right contains 9 more items, first extra item: 'Connection: keep-alive'
E
E Full diff:
E [
E - "* Connecting to '127.0.0.1'",
E - "* Connected to '127.0.0.1' on port 8000",
E - 'GET / HTTP/1.1',
E - 'Host: 127.0.0.1:8000',
E - 'Accept: */*',
E - 'Accept-Encoding: gzip, deflate, br, zstd',
E - 'Connection: keep-alive',
E - 'User-Agent: python-httpx/0.28.1',
E - '',
E 'HTTP/1.1 200 OK',
E 'server: uvicorn',
E 'content-type: text/plain',
E 'Transfer-Encoding: chunked',
E '',
E 'Hello, world!',
E ]
tests/test_main.py:126: AssertionError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
INFO: 127.0.0.1:53902 - "GET / HTTP/1.1" 200 OK
______________________________________________________________ test_auth ______________________________________________________________
server = <tests.conftest.TestServer object at 0x7f3b285b06e0>
def test_auth(server):
url = str(server.url)
runner = CliRunner()
result = runner.invoke(httpx.main, [url, "-v", "--auth", "username", "password"])
print(result.output)
assert result.exit_code == 0
> assert remove_date_header(splitlines(result.output)) == [
"* Connecting to '127.0.0.1'",
"* Connected to '127.0.0.1' on port 8000",
"GET / HTTP/1.1",
f"Host: {server.url.netloc.decode('ascii')}",
"Accept: */*",
"Accept-Encoding: gzip, deflate, br, zstd",
"Connection: keep-alive",
f"User-Agent: python-httpx/{httpx.__version__}",
"Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
"",
"HTTP/1.1 200 OK",
"server: uvicorn",
"content-type: text/plain",
"Transfer-Encoding: chunked",
"",
"Hello, world!",
]
E assert ['HTTP/1.1 200 OK', 'server: uvicorn', 'content-type: text/plain', 'Transfer-Encoding: chunked', '', 'Hello, world!'] == ["* Connecting to '127.0.0.1'", "* Connected to '127.0.0.1' on port 8000", 'GET / HTTP/1.1', 'Host: 127.0.0.1:8000', 'Accept: */*', 'Accept-Encoding: gzip, deflate, br, zstd', 'Connection: keep-alive', 'User-Agent: python-httpx/0.28.1', 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=', '', 'HTTP/1.1 200 OK', 'server: uvicorn', 'content-type: text/plain', 'Transfer-Encoding: chunked', '', 'Hello, world!']
E
E At index 0 diff: 'HTTP/1.1 200 OK' != "* Connecting to '127.0.0.1'"
E Right contains 10 more items, first extra item: 'Connection: keep-alive'
E
E Full diff:
E [
E - "* Connecting to '127.0.0.1'",
E - "* Connected to '127.0.0.1' on port 8000",
E - 'GET / HTTP/1.1',
E - 'Host: 127.0.0.1:8000',
E - 'Accept: */*',
E - 'Accept-Encoding: gzip, deflate, br, zstd',
E - 'Connection: keep-alive',
E - 'User-Agent: python-httpx/0.28.1',
E - 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=',
E - '',
E 'HTTP/1.1 200 OK',
E 'server: uvicorn',
E 'content-type: text/plain',
E 'Transfer-Encoding: chunked',
E '',
E 'Hello, world!',
E ]
tests/test_main.py:151: AssertionError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
INFO: 127.0.0.1:53918 - "GET / HTTP/1.1" 200 OK
HTTP/1.1 200 OK
date: Wed, 14 May 2025 10:34:14 GMT
server: uvicorn
content-type: text/plain
Transfer-Encoding: chunked
Hello, world!
======================================================= short test summary info =======================================================
SKIPPED [1] tests/client/test_auth.py:273: netrc files without a password are valid from Python >= 3.11
============================================== 2 failed, 1415 passed, 1 skipped in 7.10s ==============================================Reproduced with 6c7af96. To reproduce: |
Beta Was this translation helpful? Give feedback.
Answered by
mgorny
May 28, 2025
Replies: 1 comment
-
|
I'm sorry, it seems to have been a bug in |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mgorny
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm sorry, it seems to have been a bug in
click==8.2.0. The tests pass with 8.2.1.