[Python-checkins] python/dist/src/Lib/test test_urllibnet.py,1.3,1.4

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 16 May 2003 08:35:13 -0700


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

Modified Files:
	test_urllibnet.py 
Log Message:
test_fileno():  Skip this test on Windows.


Index: test_urllibnet.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllibnet.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_urllibnet.py	14 May 2003 02:18:31 -0000	1.3
--- test_urllibnet.py	16 May 2003 15:35:10 -0000	1.4
***************
*** 26,40 ****
  class urlopenNetworkTests(unittest.TestCase):
      """Tests urllib.urlopen using the network.
!     
      These tests are not exhaustive.  Assuming that testing using files does a
      good job overall of some of the basic interface features.  There are no
      tests exercising the optional 'data' and 'proxies' arguments.  No tests
      for transparent redirection have been written.
!     
      setUp is not used for always constructing a connection to
      http://www.python.org/ since there a few tests that don't use that address
      and making a connection is expensive enough to warrant minimizing unneeded
      connections.
!     
      """
  
--- 26,40 ----
  class urlopenNetworkTests(unittest.TestCase):
      """Tests urllib.urlopen using the network.
! 
      These tests are not exhaustive.  Assuming that testing using files does a
      good job overall of some of the basic interface features.  There are no
      tests exercising the optional 'data' and 'proxies' arguments.  No tests
      for transparent redirection have been written.
! 
      setUp is not used for always constructing a connection to
      http://www.python.org/ since there a few tests that don't use that address
      and making a connection is expensive enough to warrant minimizing unneeded
      connections.
! 
      """
  
***************
*** 85,98 ****
  
      def test_fileno(self):
          # Make sure fd returned by fileno is valid.
!         if hasattr(os, 'fdopen'):
!             open_url = urllib.urlopen("http://www.python.org/")
!             fd = open_url.fileno()
!             FILE = os.fdopen(fd)
!             try:
!                 self.assert_(FILE.read(), "reading from file created using fd "
!                                           "returned by fileno failed")
!             finally:
!                 FILE.close()
  
      def test_bad_address(self):
--- 85,102 ----
  
      def test_fileno(self):
+         if (sys.platform in ('win32',) or 
+                 not hasattr(os, 'fdopen')):
+             # On Windows, socket handles are not file descriptors; this
+             # test can't pass on Windows.
+             return
          # Make sure fd returned by fileno is valid.
!         open_url = urllib.urlopen("http://www.python.org/")
!         fd = open_url.fileno()
!         FILE = os.fdopen(fd)
!         try:
!             self.assert_(FILE.read(), "reading from file created using fd "
!                                       "returned by fileno failed")
!         finally:
!             FILE.close()
  
      def test_bad_address(self):
***************
*** 137,141 ****
          self.assert_(isinstance(header, mimetools.Message),
                       "header is not an instance of mimetools.Message")
!                      
  
  
--- 141,145 ----
          self.assert_(isinstance(header, mimetools.Message),
                       "header is not an instance of mimetools.Message")
!