BaseTestServer.start_server()
changes host
value to an IP address
#7166
Labels
BaseTestServer.start_server()
changes host
value to an IP address
#7166
Describe the bug
For some reason,
BaseTestServer.start_server()
changesself.host
to an IP address, which is a problem if someone is expecting a host name, e.g.localhost
. I am using aioresponses in addition to pytest-aiohttp, the latter of which creates aaiohttp.test_utils.TestServer
. The problem is that if I passhttp://localhost:{port}
toaioresponses(passthrough=[...])
and then try to do a relativeclient.get('/')
, it uses127.0.0.1
instead oflocalhost
, soaioresponses
does not try to pass that through toaiohttp
to handle it.I see that @webknjaz made the commit that added code to
start_server()
to changeself.host
to an IP address, but the commit message doesn't say why that is being done.To Reproduce
This pytest reproduction of the problem is just a slight variation of the example code from https://pypi.org/project/pytest-aiohttp/:
Expected behavior
Relative paths should work when using an
aiohttp_client
with ahost
value oflocalhost
, even when usingaioresponses
.Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Windows 11 but also in Linux:
Related component
Server, Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: