Skip to content
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

Update tests and client to properly test async mode #1517

Merged
merged 1 commit into from Feb 19, 2023

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Feb 18, 2023

This PR reintroduces proper testing of the async client and better handles incompatible options passed for sync/async.

@ml-evs ml-evs added tests Related to tests client Issues/PRs relating to the OPTIMADE client. labels Feb 18, 2023
@codecov
Copy link

codecov bot commented Feb 18, 2023

Codecov Report

Merging #1517 (463c260) into master (a8d9209) will increase coverage by 0.01%.
The diff coverage is 86.66%.

@@            Coverage Diff             @@
##           master    #1517      +/-   ##
==========================================
+ Coverage   91.01%   91.02%   +0.01%     
==========================================
  Files          74       74              
  Lines        4484     4492       +8     
==========================================
+ Hits         4081     4089       +8     
  Misses        403      403              
Flag Coverage Δ
project 91.02% <86.66%> (+0.01%) ⬆️
validator 90.91% <73.33%> (+0.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/client/client.py 81.29% <86.66%> (+0.55%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ml-evs ml-evs merged commit a029dbf into master Feb 19, 2023
@ml-evs ml-evs deleted the ml-evs/async_client_tests branch February 19, 2023 00:20
@@ -119,7 +124,7 @@ def __init__(
Parameters:
base_urls: A list of OPTIMADE base URLs to query.
max_results_per_provider: The maximum number of results to download
from each provider.
from each provider (-1 or 0 indicate unlimited).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you only want to know the number of entries that are in the database, without retrieving any actual data?
It would seem to me that if I would fill in 0 that would be exactly what I get. So it seems a bit strange to let "0" mean all results.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what the --count flag is for, which only requests a page_limit=1 and does no pagination.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring change just reflects the current behavior anyway, if its desirable we can change both

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the clarification.
It seems that the optimade python tools indeed return all results for page_limit=0.
So it makes sense to do the same here.

Perhaps we could support returning 0 resources for page_limit=0 in a future version of the optimade python tools.
So the backend database only has to do the count operation and not a find operation as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Issues/PRs relating to the OPTIMADE client. tests Related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants