[Python-checkins] python/dist/src/Lib/test test_socket.py,1.40,1.41
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 19 Jul 2002 05:46:49 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv17856
Modified Files:
test_socket.py
Log Message:
Add test for previous core dump when sending on closed socket with
timeout.
Added small sleeps to _testAccept() and _testRecv() in
NonBlockingTCPTests, to reduce race conditions (I know, this is not
the solution!)
Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** test_socket.py 18 Jul 2002 17:08:35 -0000 1.40
--- test_socket.py 19 Jul 2002 12:46:46 -0000 1.41
***************
*** 326,330 ****
self.assertRaises(TypeError, socket.setdefaulttimeout, "spam")
! # XXX The following three don't test module-level functionality...
def testSockName(self):
--- 326,330 ----
self.assertRaises(TypeError, socket.setdefaulttimeout, "spam")
! # XXX The following don't test module-level functionality...
def testSockName(self):
***************
*** 349,352 ****
--- 349,359 ----
self.failIf(reuse == 0, "failed to set reuse mode")
+ def testSendAfterClose(self):
+ """testing send() after close() with timeout."""
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.settimeout(1)
+ sock.close()
+ self.assertRaises(socket.error, sock.send, "spam")
+
class BasicTCPTest(SocketConnectedTest):
***************
*** 487,490 ****
--- 494,498 ----
def _testAccept(self):
+ time.sleep(0.1)
self.cli.connect((HOST, PORT))
***************
*** 516,519 ****
--- 524,528 ----
def _testRecv(self):
self.cli.connect((HOST, PORT))
+ time.sleep(0.1)
self.cli.send(MSG)