diff options
-rw-r--r-- | t/unit/test_transport.py | 19 |
1 files 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 |