Repository navigation
Conversation
- `list_properties` no longer raises an AttributeError when one of the databases cannot be queried: a failed query leaves its data as an empty list, so such databases are now skipped (their error is already reported). - `search_property` now lists the properties of an entry type that has not been listed yet, and `list_properties` updates the cache instead of replacing it, so earlier entry types are kept. - Each client now has its own `property_lists` cache rather than sharing the mutable class attribute. - `test_list_properties` called `search_property` with its arguments swapped, so its assertion never ran; fix the call and the expected value, and add tests for the cases above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anikeya9
requested review from
CasperWA,
ml-evs,
ndaelman-hu and
rartino
as code owners
November 13, 2026 22:40
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2461 +/- ##
==========================================
+ Coverage 90.37% 90.59% +0.22%
==========================================
Files 78 78
Lines 5122 5126 +4
==========================================
+ Hits 4629 4644 +15
+ Misses 493 482 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2460
Fixes three bugs in
OptimadeClient.list_properties/search_property; see the issue for the reproductions.list_propertiesraiseAttributeErrorfor all databases (a failed query leavesQueryResults.dataas an empty list)get_one. This also removes the# type: ignorethat hid the problem from mypytest_list_properties_failed_database(one of the three test URLs raises a connection error)test_list_propertiescalledsearch_property("structures", "site")with the arguments swapped, so it got{}and its assertion never rantest_list_propertiessearch_propertyreturns{}for an entry type that was not listed first, andlist_propertiesdiscards the entry types listed beforetest_search_property_multiple_entry_typesOne extra change, needed for C:
property_listsis a mutable class attribute (defaultdict(dict)), and__init__never set it, so it was only kept per instance becauselist_propertiesre-assigned it. Updating it in place would have shared the cache between allOptimadeClientinstances, so each client now creates its own in__init__.test_search_property_multiple_entry_typeschecks this too.Verification
main(A:AttributeError, C:{}instead of{'https://example.com': ['year']}), in both sync and async mode, and pass with this PR; without the__init__change, the shared-cache check fails.tests/server/test_client.pypasses (144 tests), as do pre-commit and mypy.optimade-get --list-properties structuresacross all providers: onmainit crashed after 5 providers returned errors; with this PR, the same 5 errors are printed and the properties of the other 45 databases are returned.Design choice: databases whose query failed are left out of the result rather than given an empty list, since an empty list would read as "this database serves no properties". Happy to change this if you prefer otherwise.
🤖 Generated with Claude Code