From d39c26b358544d96520c024a336b04fc2fad436a Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 15 Dec 2023 14:26:44 +0000 Subject: [PATCH] remember to close removed connections --- vcr/patch.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vcr/patch.py b/vcr/patch.py index a9e86bd..68701a3 100644 --- a/vcr/patch.py +++ b/vcr/patch.py @@ -372,10 +372,6 @@ class ConnectionRemover: if isinstance(connection, self._connection_class): self._connection_pool_to_connections.setdefault(pool, set()).add(connection) - def remove_connection_to_pool_entry(self, pool, connection): - if isinstance(connection, self._connection_class): - self._connection_pool_to_connections[self._connection_class].remove(connection) - def __enter__(self): return self @@ -386,6 +382,7 @@ class ConnectionRemover: connection = pool.pool.get() if isinstance(connection, self._connection_class): connections.remove(connection) + connection.close() else: readd_connections.append(connection) for connection in readd_connections: