From 665e95bc1ecd3c95ff814b91471a369c0101b255 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Wed, 15 Dec 2021 13:49:48 -0500 Subject: Unit test should run against all transport classes --- t/unit/test_transport.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/t/unit/test_transport.py b/t/unit/test_transport.py index 0c7b0e2..348b6c2 100644 --- a/t/unit/test_transport.py +++ b/t/unit/test_transport.py @@ -587,6 +587,16 @@ class test_AbstractTransport_connect: self.t.connect() assert self.t.connected and self.t.sock is sock_obj + def test_close__close_error(self): + # sock.close() can raise an error if the fd is invalid + # make sure the socket is properly deallocated + sock = self.t.sock = Mock() + sock.unwrap.return_value = sock + sock.close.side_effect = OSError + self.t.close() + sock.close.assert_called_with() + assert self.t.sock is None and self.t.connected is False + class test_SSLTransport: class Transport(transport.SSLTransport): @@ -843,15 +853,6 @@ class test_SSLTransport: self.t.close() assert self.t.sock is None - def test_close__close_error(self): - # sock.close() can raise an error if the fd is invalid - # make sure the socket is properly deallocated - sock = self.t.sock = Mock() - sock.close.side_effect = OSError - self.t.close() - sock.close.assert_called_with() - assert self.t.sock is None and self.t.connected is False - def test_read_EOF(self): self.t.sock = Mock(name='SSLSocket') self.t.connected = True -- cgit v1.2.1