-
Notifications
You must be signed in to change notification settings - Fork 8
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
Unfreeze PyMongo and replace deprecated count() with count_documents() #124
Conversation
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.
Looks good 👍 Test with a relevant CLI cmd perhaps?
That's a good idea, I'll fix tomorrow. Thanks for the review! |
Mmm I've changed the automatic tests to run with Mongo 7 and a new version of PyMongo, but I see that there are some deprecated methods in the code that shouldn't be supported in the older versions of pymongo. Perhaps these are not covered by the tests. I'll fix! |
Ok, now I feel thsi ready for a review @henrikstranneheim, thanks! |
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.
Great that you added tests 👍
loqusdb/commands/identity.py
Outdated
result = adapter.get_clusters(variant_id) | ||
if result.count() == 0: | ||
nr_results = adapter.db.identity.count_documents({"variant_id": variant_id}) | ||
if nr_results == 0: | ||
LOG.info("No hits for variant %s", variant_id) |
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.
f-str
tests/commands/test_export.py
Outdated
|
||
from loqusdb.commands.cli import cli as base_command | ||
|
||
def test_export_base(real_db_name): |
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.
Add type hint
|
||
## THEN it should return success | ||
result = runner.invoke(base_command, command) | ||
assert result.exit_code == 0 |
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.
Can we also test that it actually exported a file?
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.
tests/commands/test_identity.py
Outdated
|
||
from loqusdb.commands.cli import cli as base_command | ||
|
||
def test_identity(real_db_name): |
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.
Add type hint
tests/commands/test_view.py
Outdated
|
||
from loqusdb.commands.cli import cli as base_command | ||
|
||
def test_view_cases_base(real_mongo_adapter, real_db_name): |
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.
Add type hints
Co-authored-by: Henrik Stranneheim <henrik.stranneheim@scilifelab.se>
Co-authored-by: Henrik Stranneheim <henrik.stranneheim@scilifelab.se>
This PR adds | fixes:
.count()
function withcount_documents()
in code.How to test:
Expected outcome:
Review:
This version is a: