Make use of a change to netlib.tcp that clarifies error conditions for flush and close.

Should fix #144.
This commit is contained in:
Aldo Cortesi 2013-07-30 09:42:29 +12:00
parent 5f0b5532bc
commit 439d9a294c
2 changed files with 3 additions and 6 deletions

View File

@ -85,12 +85,9 @@ class ServerConnection(tcp.TCPClient):
if self.connection:
try:
self.wfile.flush()
except IOError, tcp.NetLibDisconnect: # pragma: no cover
pass
try:
self.connection.close()
except IOError:
except tcp.NetLibDisconnect: # pragma: no cover
pass
self.connection.close()

View File

@ -56,7 +56,7 @@ class TestServerConnection:
sc = proxy.ServerConnection(proxy.ProxyConfig(), "http", self.d.IFACE, self.d.port, "host.com")
sc.connect()
sc.connection = mock.Mock()
sc.connection.close = mock.Mock(side_effect=IOError)
sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect)
sc.terminate()