diff --git a/openfga_sdk/rest.py b/openfga_sdk/rest.py index b3e81089..235523aa 100644 --- a/openfga_sdk/rest.py +++ b/openfga_sdk/rest.py @@ -409,9 +409,6 @@ async def stream( # Release the response object (required!) response.release() - # Release the connection back to the pool - await self.close() - async def request( self, method: str, diff --git a/openfga_sdk/sync/rest.py b/openfga_sdk/sync/rest.py index fb083430..094d6fd7 100644 --- a/openfga_sdk/sync/rest.py +++ b/openfga_sdk/sync/rest.py @@ -452,9 +452,6 @@ def stream( # Release the response object (required!) response.release_conn() - # Release the connection back to the pool - self.close() - def request( self, method: str, diff --git a/test/rest_test.py b/test/rest_test.py index 03d9d86c..1b04e15f 100644 --- a/test/rest_test.py +++ b/test/rest_test.py @@ -319,7 +319,6 @@ async def iter_chunks(self): client.handle_response_exception.assert_awaited_once() mock_response.release.assert_called_once() - client.close.assert_awaited_once() @pytest.mark.asyncio @@ -364,7 +363,6 @@ async def iter_chunks(self): assert results == [] client.handle_response_exception.assert_awaited_once() mock_response.release.assert_called_once() - client.close.assert_awaited_once() @pytest.mark.asyncio @@ -411,4 +409,3 @@ async def iter_chunks(self): client.handle_response_exception.assert_awaited_once() mock_response.release.assert_called_once() - client.close.assert_awaited_once() diff --git a/test/sync/rest_test.py b/test/sync/rest_test.py index bb59d40c..c486bf51 100644 --- a/test/sync/rest_test.py +++ b/test/sync/rest_test.py @@ -288,6 +288,7 @@ def test_close(): client.pool_manager = mock_pool_manager client.close() + mock_pool_manager.clear.assert_called_once() @@ -333,7 +334,6 @@ def test_request_preload_content(): assert isinstance(resp, RESTResponse) assert resp.status == 200 assert resp.data == b'{"some":"data"}' - mock_pool_manager.clear.assert_called_once() def test_request_no_preload_content(): @@ -380,7 +380,6 @@ def test_request_no_preload_content(): # We expect the raw HTTPResponse assert resp == mock_raw_response assert resp.status == 200 - mock_pool_manager.clear.assert_called_once() def test_stream_happy_path(): @@ -431,7 +430,6 @@ def release_conn(self): assert results == [{"foo": "bar"}, {"hello": "world"}] mock_pool_manager.request.assert_called_once() - mock_pool_manager.clear.assert_called_once() def test_stream_partial_chunks(): @@ -483,7 +481,6 @@ def release_conn(self): assert results == [{"foo": "bar"}, {"hello": "world"}] mock_pool_manager.request.assert_called_once() - mock_pool_manager.clear.assert_called_once() def test_stream_exception_in_chunks(): @@ -534,4 +531,3 @@ def release_conn(self): # Exception is logged, we yield nothing assert results == [] mock_pool_manager.request.assert_called_once() - mock_pool_manager.clear.assert_called_once()