Skip to content

Commit

Permalink
Add host parameter to aiohttp_server fixture (#10120) (#10121) (#10150)
Browse files Browse the repository at this point in the history
Co-authored-by: ChristianWBrock <christian.brock AT posteo.net>
(cherry picked from commit 7f8e2d3)

Co-authored-by: christianwbrock <[email protected]>
  • Loading branch information
Dreamsorcerer and christianwbrock authored Dec 9, 2024
1 parent eb42db8 commit 51cdda8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/10120.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added ``host`` parameter to ``aiohttp_server`` fixture -- by :user:`christianwbrock`.
8 changes: 6 additions & 2 deletions aiohttp/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,13 @@ def aiohttp_server(loop: asyncio.AbstractEventLoop) -> Iterator[AiohttpServer]:
servers = []

async def go(
app: Application, *, port: Optional[int] = None, **kwargs: Any
app: Application,
*,
host: str = "127.0.0.1",
port: Optional[int] = None,
**kwargs: Any,
) -> TestServer:
server = TestServer(app, port=port)
server = TestServer(app, host=host, port=port)
await server.start_server(loop=loop, **kwargs)
servers.append(server)
return server
Expand Down

0 comments on commit 51cdda8

Please sign in to comment.