try/except/finally is a 2.5 feature
This commit is contained in:
@@ -40,12 +40,13 @@ class TestSocketErrors(unittest.TestCase):
|
|||||||
cs, addr = server.accept()
|
cs, addr = server.accept()
|
||||||
cs.settimeout(1)
|
cs.settimeout(1)
|
||||||
try:
|
try:
|
||||||
cs.recv(1024)
|
try:
|
||||||
self.fail("Should have timed out")
|
cs.recv(1024)
|
||||||
except socket.timeout, ex:
|
self.fail("Should have timed out")
|
||||||
assert hasattr(ex, 'args')
|
except socket.timeout, ex:
|
||||||
assert len(ex.args) == 1
|
assert hasattr(ex, 'args')
|
||||||
assert ex.args[0] == 'timed out'
|
assert len(ex.args) == 1
|
||||||
|
assert ex.args[0] == 'timed out'
|
||||||
finally:
|
finally:
|
||||||
s.close()
|
s.close()
|
||||||
cs.close()
|
cs.close()
|
||||||
|
Reference in New Issue
Block a user