diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-05-16 15:35:10 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-05-16 15:35:10 (GMT) |
commit | 813cec9a620e164d749ae9d36b72d0efd9260c07 (patch) | |
tree | 746c7b0f9e1bbfa6938533dd6182008ad7af1380 /Lib/test/test_urllibnet.py | |
parent | 047c54bb2400c14057ecbd32d646d08621ee703e (diff) | |
download | cpython-813cec9a620e164d749ae9d36b72d0efd9260c07.zip cpython-813cec9a620e164d749ae9d36b72d0efd9260c07.tar.gz cpython-813cec9a620e164d749ae9d36b72d0efd9260c07.tar.bz2 |
test_fileno(): Skip this test on Windows.
Diffstat (limited to 'Lib/test/test_urllibnet.py')
-rw-r--r-- | Lib/test/test_urllibnet.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index f38a2d0..dcf9103 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -25,17 +25,17 @@ class URLTimeoutTest(unittest.TestCase): 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. - + """ def test_basic(self): @@ -84,16 +84,20 @@ class urlopenNetworkTests(unittest.TestCase): self.assertEqual(gotten_url, URL) 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. - 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() + 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): # Make sure proper exception is raised when connecting to a bogus @@ -136,7 +140,7 @@ class urlretrieveNetworkTests(unittest.TestCase): os.unlink(file_location) self.assert_(isinstance(header, mimetools.Message), "header is not an instance of mimetools.Message") - + def test_main(): |