diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-07-01 15:33:37 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-07-01 15:33:37 (GMT) |
commit | 7596e8342ea34108d773d1802d5147e9884b547f (patch) | |
tree | aa19561ab430e4a5b9edee0409ceb4943339edd6 /Lib/test/test_socket.py | |
parent | a09803329c6315792a9dee92c9d4d9bfe6eab01a (diff) | |
download | cpython-7596e8342ea34108d773d1802d5147e9884b547f.zip cpython-7596e8342ea34108d773d1802d5147e9884b547f.tar.gz cpython-7596e8342ea34108d773d1802d5147e9884b547f.tar.bz2 |
Release all forwarded functions in .close. Fixes #1513223.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index e773eab..b7d3916 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -582,6 +582,21 @@ class BasicUDPTest(ThreadedUDPSocketTest): def _testRecvFrom(self): self.cli.sendto(MSG, 0, (HOST, PORT)) +class TCPCloserTest(ThreadedTCPSocketTest): + + def testClose(self): + conn, addr = self.serv.accept() + conn.close() + + sd = self.cli + read, write, err = select.select([sd], [], [], 1.0) + self.assertEqual(read, [sd]) + self.assertEqual(sd.recv(1), '') + + def _testClose(self): + self.cli.connect((HOST, PORT)) + time.sleep(1.0) + class BasicSocketPairTest(SocketPairTest): def __init__(self, methodName='runTest'): @@ -890,8 +905,8 @@ class BufferIOTest(SocketConnectedTest): self.serv_conn.send(buf) def test_main(): - tests = [GeneralModuleTests, BasicTCPTest, TCPTimeoutTest, TestExceptions, - BufferIOTest] + tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest, + TestExceptions, BufferIOTest] if sys.platform != 'mac': tests.extend([ BasicUDPTest, UDPTimeoutTest ]) |