test: SSE tests use stream=True without closing response (test hygiene)
Author: xianyu-shengCreated Aug 4, 2026Updated Aug 4, 2026
Description
In integration_tests/test_sse.py:298-302, requests.get(stream=True) is used without closing the response:
def test_sse_error_handling():
response = requests.get(f"{BASE_URL}/sse/nonexistent", stream=True)
assert response.status_code == 404When stream=True is used, the connection is kept open and the response must be explicitly closed with response.close(). Without it, the underlying socket may not be returned to the connection pool, causing a resource leak.
Suggested fix
Use a context manager or explicitly close:
def test_sse_error_handling():
with requests.get(f"{BASE_URL}/sse/nonexistent", stream=True) as response:
assert response.status_code == 404Environment
- Robyn version: latest main
- Python requests library behavior with stream=True
Discovered by SmartBench
Source: sparckles/Robyn