-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Description
Reproducible example that I think is minimal:
import httpx
from mocket.mockhttp import Entry
from mocket import async_mocketize
@pytest.mark.asyncio
@async_mocketize
async def test_many():
url = "http://httpbin.local/ip"
Entry.single_register(Entry.GET, url, status=404)
for i in range(200):
async with httpx.AsyncClient() as client:
response = await client.get(url)
assert response.status_code == 404With number of open files limited in order to make it easier to hit the limit:
ulimit -n 100This fails like so :
.devenv/state/venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py:1627: in connect_tcp
await get_running_loop().create_connection(
/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/asyncio/base_events.py:1085: in create_connection
raise exceptions[0]
/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/asyncio/selector_events.py:632: in sock_connect
self._sock_connect(fut, sock, address)
/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/asyncio/selector_events.py:640: in _sock_connect
fd = sock.fileno()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@staticmethod
def fileno():
> Mocket.r_fd, Mocket.w_fd = os.pipe()
E OSError: [Errno 24] Too many open files
mocket/mocket.py:260: OSError
Metadata
Metadata
Assignees
Labels
No labels