-
-
Notifications
You must be signed in to change notification settings - Fork 867
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
Azure: raise FileNotFoundError when requested blob is missing from storage #1358
base: master
Are you sure you want to change the base?
Azure: raise FileNotFoundError when requested blob is missing from storage #1358
Conversation
…ling Azure: raise FileNotFoundError when requested blob is missing from storage
Thanks, makes sense to fix this. Any idea about doing the same kind of RAII-style handling in init of |
tests/test_azure.py
Outdated
client_mock.exists.side_effect = [True, False] | ||
self.storage._client.get_blob_client.return_value = client_mock | ||
|
||
file_that_exists = self.storage._open('file-that-exists') |
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 change this to use open()
as that is the public API. Also to use a with
context handler.
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.
I've just pushed commits to make these changes
I'm not sure I understand the existing code / Azure SDK well enough to say, tbh. It looks like where that's done in the |
eadfbf8
to
9be64e6
Compare
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.
This will break since #1422. My suggestion is to do something similar to S3 and reference self.file
in the constructor of AzureFile since that will properly try to download the file.
This version I think also will break if a file is opened for writing.
This PR implements behaviour in
AzureStorage._open
similar to that already found inS3Storage._open
, raising aFileNotFoundError
if the blob doesn't exist in the storage.