diff options
author | Michael Lazar <mlazar@doctorondemand.com> | 2021-12-15 13:49:48 -0500 |
---|---|---|
committer | Asif Saif Uddin <auvipy@gmail.com> | 2021-12-16 09:53:34 +0600 |
commit | 665e95bc1ecd3c95ff814b91471a369c0101b255 (patch) | |
tree | 3b45d5a92fb1123d53f2a0be8251d4729cbf6a66 | |
parent | f4fd4f952dded9ea1006e82642f2c15008bb68d3 (diff) | |
download | py-amqp-665e95bc1ecd3c95ff814b91471a369c0101b255.tar.gz |
Unit test should run against all transport classes
-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 |