Skip to content

Commit

Permalink
AzureStorageTest.test_missing_file_handling: use context handler when…
Browse files Browse the repository at this point in the history
… opening storage
  • Loading branch information
alxbridge committed May 1, 2024
1 parent 43e07c8 commit eadfbf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def test_missing_file_handling(self):
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')
self.assertIsInstance(file_that_exists, azure_storage.AzureStorageFile)
with self.storage.open('file-that-exists') as file_that_exists:
self.assertIsInstance(file_that_exists, azure_storage.AzureStorageFile)

self.assertRaises(FileNotFoundError, self.storage.open, 'file-that-does-not-exist')

0 comments on commit eadfbf8

Please sign in to comment.