-
Notifications
You must be signed in to change notification settings - Fork 152
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
Raise Error when HTTPReader get 404 Response (#160) #569
Conversation
- Add line of requests raise_for_status() will only allow 200 accepted requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a test to https://github.com/pytorch/data/blob/main/test/test_remote_io.py#L60 which tries to load an unexisting url?
shorten the error message ([:54]), but the important thing is that the 404 response comes out
@VitalyFedyunin |
test/test_remote_io.py
Outdated
# Error Test: test if the Http Reader raises an error when the url is invalid | ||
error_url = "https://github.com/pytorch/data/this/url/dont/exist" | ||
http_error_dp = HttpReader(IterableWrapper([error_url]), timeout=timeout) | ||
with self.assertRaises(Exception) as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use assertRaisesRegex
it will reduce lines 91-92 to simple check.
@NivekT has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@NivekT has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Fixes #160
Changes
Comments