[Python-checkins] python/dist/src/Lib/test test_socket.py, 1.72,
1.73
davecole at users.sourceforge.net
davecole at users.sourceforge.net
Mon Aug 9 06:51:43 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20818/Lib/test
Modified Files:
test_socket.py
Log Message:
Patch #1003700: Add socketpair function to socket module.
Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** test_socket.py 12 Jul 2004 12:10:30 -0000 1.72
--- test_socket.py 9 Aug 2004 04:51:40 -0000 1.73
***************
*** 188,191 ****
--- 188,213 ----
ThreadedTCPSocketTest.clientTearDown(self)
+ class SocketPairTest(unittest.TestCase, ThreadableTest):
+
+ def __init__(self, methodName='runTest'):
+ unittest.TestCase.__init__(self, methodName=methodName)
+ ThreadableTest.__init__(self)
+
+ def setUp(self):
+ self.serv, self.cli = socket.socketpair()
+
+ def tearDown(self):
+ self.serv.close()
+ self.serv = None
+
+ def clientSetUp(self):
+ pass
+
+ def clientTearDown(self):
+ self.cli.close()
+ self.cli = None
+ ThreadableTest.clientTearDown(self)
+
+
#######################################################################
## Begin Tests
***************
*** 542,545 ****
--- 564,586 ----
self.cli.sendto(MSG, 0, (HOST, PORT))
+ class BasicSocketPairTest(SocketPairTest):
+
+ def __init__(self, methodName='runTest'):
+ SocketPairTest.__init__(self, methodName=methodName)
+
+ def testRecv(self):
+ msg = self.serv.recv(1024)
+ self.assertEqual(msg, MSG)
+
+ def _testRecv(self):
+ self.cli.send(MSG)
+
+ def testSend(self):
+ self.serv.send(MSG)
+
+ def _testSend(self):
+ msg = self.cli.recv(1024)
+ self.assertEqual(msg, MSG)
+
class NonBlockingTCPTests(ThreadedTCPSocketTest):
***************
*** 787,790 ****
--- 828,833 ----
SmallBufferedFileObjectClassTestCase
])
+ if hasattr(socket, "socketpair"):
+ tests.append(BasicSocketPairTest)
test_support.run_unittest(*tests)
More information about the Python-checkins
mailing list