-
Notifications
You must be signed in to change notification settings - Fork 1
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 load attachments for same shared cache/cache #317
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files |
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.
Purpose
Fixes duplicate attachment problem when the same caches are used in both env pointing to cache directories.
Review
I will approve these. I have only minor stuff:
the test setup is really long, and the assertions are only very short. Would it make sense to refactor this to make the test more readable? In the pytest idiom using fixtures, or even a classical unittest test class with setup and teardown - or a mix of both. Not for functionality, but for readability. As said this is only an option.
I also wonder whether more can / needs to be asserted. I understand that the sort order when duplicates are dropped (keep="first"
) can not be so easily tested.
As said I am unsure whether reasonable extended assertions exist at all.
This is very often a problem for tests of One solution might be to create a |
That's correct, but in our special case of the dependency table, whenever an index is duplicated, the whole row is identical. So the dropping order can have no influence. Hence, it should be fine without having a test for it. |
Ok for me. |
Closes #314.
This ensures that
audb.core.load._cached_versions()
does not return duplicated entries, whenaudb.config.SHARED_CACHE_ROOT
andaudb.config.CACHE_ROOT
point to the same folder.As
audb.core.load._get_attachments_from_cache()
is setting a folder lock to all folders given byaudb.core.load._cached_versions()
at the same time, this can then no longer lead to a folder lock error,and finally it will no longer result in an error/user warning when running
audb.load()
.