diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-09 20:39:54 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-09 20:39:54 (GMT) |
commit | 6e451df800af66eefe68ea15938bd65029af06c5 (patch) | |
tree | 3a94bf3c48a965f464f1f112d384076103a4676a /Lib/test/test_socket.py | |
parent | 30e86a47676d2175901af29445aec5bd7967ef76 (diff) | |
download | cpython-6e451df800af66eefe68ea15938bd65029af06c5.zip cpython-6e451df800af66eefe68ea15938bd65029af06c5.tar.gz cpython-6e451df800af66eefe68ea15938bd65029af06c5.tar.bz2 |
Followup to r83869 and issue #8524: rename socket.forget() to socket.detach()
and make it return the file descriptor.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index ae34c11..a95e743 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -655,17 +655,21 @@ class BasicTCPTest(SocketConnectedTest): self.serv_conn.send(MSG) self.serv_conn.shutdown(2) - def testForget(self): - # Testing forget() - f = self.cli_conn.fileno() - self.cli_conn.forget() + def testDetach(self): + # Testing detach() + fileno = self.cli_conn.fileno() + f = self.cli_conn.detach() + self.assertEqual(f, fileno) + # cli_conn cannot be used anymore... self.assertRaises(socket.error, self.cli_conn.recv, 1024) self.cli_conn.close() + # ...but we can create another socket using the (still open) + # file descriptor sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno=f) msg = sock.recv(1024) self.assertEqual(msg, MSG) - def _testForget(self): + def _testDetach(self): self.serv_conn.send(MSG) @unittest.skipUnless(thread, 'Threading required for this test.') |