[Python-checkins] python/dist/src/Lib/test test_socket.py,1.54,1.55

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 08 Aug 2002 13:28:37 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv10494

Modified Files:
	test_socket.py 
Log Message:
testSendAll(): loop until all data is read; this was necessary at
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.


Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** test_socket.py	8 Aug 2002 20:19:19 -0000	1.54
--- test_socket.py	8 Aug 2002 20:28:34 -0000	1.55
***************
*** 379,389 ****
      def testSendAll(self):
          # Testing sendall() with a 2048 byte string over TCP
          while 1:
              read = self.cli_conn.recv(1024)
              if not read:
                  break
!             self.assert_(len(read) == 1024, "Error performing sendall.")
!             read = filter(lambda x: x == 'f', read)
!             self.assert_(len(read) == 1024, "Error performing sendall.")
  
      def _testSendAll(self):
--- 379,389 ----
      def testSendAll(self):
          # Testing sendall() with a 2048 byte string over TCP
+         msg = ''
          while 1:
              read = self.cli_conn.recv(1024)
              if not read:
                  break
!             msg += read
!         self.assertEqual(msg, 'f' * 2048)
  
      def _testSendAll(self):