#1432·Robyn

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:

python
def test_sse_error_handling():
    response = requests.get(f"{BASE_URL}/sse/nonexistent", stream=True)
    assert response.status_code == 404

When 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:

python
def test_sse_error_handling():
    with requests.get(f"{BASE_URL}/sse/nonexistent", stream=True) as response:
        assert response.status_code == 404

Environment

  • Robyn version: latest main
  • Python requests library behavior with stream=True

Discovered by SmartBench