Skip to content

Commit 8d1f935

Browse files
authored
Remove catching OSError in ftphandler test. Only URLError is raised in urllib.request module. (#918) (#920)
(cherry picked from commit ed3dd1c)
1 parent 599bb18 commit 8d1f935

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Lib/test/test_urllib2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ def test_file(self):
830830
for url, ftp in [
831831
("file://ftp.example.com//foo.txt", False),
832832
("file://ftp.example.com///foo.txt", False),
833-
# XXXX bug: fails with OSError, should be URLError
834833
("file://ftp.example.com/foo.txt", False),
835834
("file://somehost//foo/something.txt", False),
836835
("file://localhost//foo/something.txt", False),
@@ -839,7 +838,7 @@ def test_file(self):
839838
try:
840839
h.file_open(req)
841840
# XXXX remove OSError when bug fixed
842-
except (urllib.error.URLError, OSError):
841+
except urllib.error.URLError:
843842
self.assertFalse(ftp)
844843
else:
845844
self.assertIs(o.req, req)
@@ -1689,7 +1688,6 @@ def test_invalid_closed(self):
16891688
self.assertTrue(conn.fakesock.closed, "Connection not closed")
16901689

16911690

1692-
16931691
class MiscTests(unittest.TestCase):
16941692

16951693
def opener_has_handler(self, opener, handler_class):

0 commit comments

Comments
 (0)