fix: create blueapi cache folder on login#1520
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1520 +/- ##
=======================================
Coverage 95.34% 95.35%
=======================================
Files 43 43
Lines 3200 3205 +5
=======================================
+ Hits 3051 3056 +5
Misses 149 149 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5181f8f to
36ebbfc
Compare
| os.chmod(self._file_path, 0o600) | ||
|
|
||
| def load_cache(self) -> Cache: | ||
| self._create_parent_folder_if_necessary() |
There was a problem hiding this comment.
Do we need to create the directory on load? If it doesn't exist, I imagine this will behave the same as if the cache file doesn't exist which is (hopefully) already handled.
There was a problem hiding this comment.
If you look in the stack trace on the ticket there were 2 errors thrown, the first when trying to open the file in this method, and the second when calling can_access_cache as part of the error handling for the first error.
If it is correct that this method should error and fall back on the error handling if the folder doesn't exist, then this can be removed, otherwise it does need to stay
There was a problem hiding this comment.
I think load_cache will still throw the exception when the file doesn't exist so creating the directory doesn't really achieve much. The second exception where it can't start the device flow does need the directory to be present.
It doesn't really matter though so feel free to leave it if it would otherwise hold up the bug being fixed.
Co-authored-by: Peter Holloway <peter.holloway@diamond.ac.uk>
47f7c6c to
d4b4d28
Compare
Check for the existence of the blueapi cache folder on login and if it doesn't exist create it.
fixes 1448