-
-
Notifications
You must be signed in to change notification settings - Fork 378
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
fix: S3 ignore seek requests to the current position #748
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,8 +70,10 @@ def test_good_id(self): | |
def test_bad_id(self): | ||
"""Does passing an invalid version_id exception into the s3 submodule get handled correctly?""" | ||
params = {'version_id': 'bad-version-does-not-exist'} | ||
with self.assertRaises(IOError): | ||
open(self.url, 'rb', transport_params=params) | ||
with open(self.url, 'rb', transport_params=params) as fin: | ||
with self.assertRaises(IOError): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not change this test. Opening the URL to a non-existent object should raise an error, before any reading is attempted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I hadn't changed this in my fork of the code. But then again I wasn't aiming to make a PR. I could check what errors the fix raise during tests and see if there is a sensible way to incorporate them without changing core functionality. |
||
fin.read() | ||
|
||
|
||
def test_bad_mode(self): | ||
"""Do we correctly handle non-None version when writing?""" | ||
|
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.
The optimization idea is good, but we need to maintain the current behavior of the library. That is, the seek should always be performed when opening the file. Perhaps we could initialize self._current_pos to -1 to achieve this.