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