Skip to content

Narrow the Exception in test_urllib2 test. Catch URLError, not OSError #918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Lib/test/test_urllib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ def test_file(self):
for url, ftp in [
("file://ftp.example.com//foo.txt", False),
("file://ftp.example.com///foo.txt", False),
# XXXX bug: fails with OSError, should be URLError
("file://ftp.example.com/foo.txt", False),
("file://somehost//foo/something.txt", False),
("file://localhost//foo/something.txt", False),
Expand All @@ -839,7 +838,7 @@ def test_file(self):
try:
h.file_open(req)
# XXXX remove OSError when bug fixed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm referring to this comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, it's right there in the context and still I missed it. Thanks for point out. I will remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's removed now: #1020
Thank you for catching.

except (urllib.error.URLError, OSError):
except urllib.error.URLError:
self.assertFalse(ftp)
else:
self.assertIs(o.req, req)
Expand Down Expand Up @@ -1689,7 +1688,6 @@ def test_invalid_closed(self):
self.assertTrue(conn.fakesock.closed, "Connection not closed")



class MiscTests(unittest.TestCase):

def opener_has_handler(self, opener, handler_class):
Expand Down