From 13ef2a88e089dbc798e03b5eadf3c5f486d5d6ff Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:11:17 -0700 Subject: [PATCH 1/2] Update pool.py --- src/epplibwrapper/utility/pool.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/epplibwrapper/utility/pool.py b/src/epplibwrapper/utility/pool.py index a5a5adaaa..442f6257a 100644 --- a/src/epplibwrapper/utility/pool.py +++ b/src/epplibwrapper/utility/pool.py @@ -101,6 +101,8 @@ class EPPConnectionPool(ConnectionPool): gevent.killall(self.greenlets) self.greenlets.clear() + for connection in self.conn: + connection.disconnect() self.conn.clear() # Clear the semaphore From 6f31e02f2b0db7019bf1728a690c55e1319abf9a Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Wed, 15 Nov 2023 11:28:11 -0700 Subject: [PATCH 2/2] Fix tests --- src/epplibwrapper/tests/test_pool.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/epplibwrapper/tests/test_pool.py b/src/epplibwrapper/tests/test_pool.py index 1a5a2ccf7..1c36d26da 100644 --- a/src/epplibwrapper/tests/test_pool.py +++ b/src/epplibwrapper/tests/test_pool.py @@ -125,10 +125,14 @@ class TestConnectionPool(TestCase): xml = (location).read_bytes() return xml + def do_nothing(command): + pass + # Mock what happens inside the "with" with ExitStack() as stack: stack.enter_context(patch.object(EPPConnectionPool, "_create_socket", self.fake_socket)) stack.enter_context(patch.object(Socket, "connect", self.fake_client)) + stack.enter_context(patch.object(EPPConnectionPool, "kill_all_connections", do_nothing)) stack.enter_context(patch.object(SocketTransport, "send", self.fake_send)) stack.enter_context(patch.object(SocketTransport, "receive", fake_receive)) # Restart the connection pool