-
Notifications
You must be signed in to change notification settings - Fork 4
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
Delete unnecessary test and context manager #292
Conversation
Coverage actually decreases by 0.02% here because this code is uncovered: def _default_portal_client(client_address) -> PortalClient:
return PortalClient(client_address) # this line I think it might be a good idea to modify at least one of the tests using |
I'm a bit suspicious of the last test failure. I don't think any of my changes should have caused this, at least. It seems like it could be a rare timing failure that we happen not to have hit yet, but I'm not sure. The Anyway, codecov is now reporting a 0.00% change from main, as desired! |
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, thanks for coming back to smooth this over. Please update the releasenotes before merging!
basic_collection = optimization_result_collection.to_basic_result_collection( | ||
"hessian" | ||
) |
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.
(not blocking)
I think it might be a good idea to modify at least one of the tests using portal_client_manager to ensure that a plain PortalClient works. I changed every test to use _CachedPortalClient when it was going to become the new default in #286 to avoid sharing the same cache directories, but now it should be safe to get rid of some of those TemporaryDirectory and portal_client_manager calls again.
Yeah, it's good that you caught that default_portal_client
was going to go uncovered and changed some of these back. It seems a little brittle that a newcomer wouldn't understand why some tests are using portal_client_manager
and others aren't. But that can be a topic for a future PR (maybe a dedicated test for default/non-default clients? Or some pattern of using pytest.parameterize
that doesn't double runtime?). If you can think of a clean comment to leave explaining this (like # this test doesn't use portal_client_manager just so it can test out the default pathway
) could you add it before merging?
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.
Should I include this comment in each of the four tests that no longer use portal_client_manager
? I guess I was thinking that since that is the default behavior, it makes sense for it to be the default test behavior too. Possibly I should instead comment on the one test still using portal_client_manager
(test_to_records
) to point out why it's being used there?
Maybe it would have been better if I had just copy-pasted test_to_records
to begin with to have a dedicated test_cached_to_records
test as you mention. I thought I would only have to make small changes to test_to_records
at first, but in the end it basically became a different test anyway.
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.
Let's put a comment on the one test that uses caching, like "as of Aug 2024, this is the one place we're testing caching"
I think I only changed tests and a docstring in a private method. Should I still add something to the releasenotes? |
Ah, good catch, no need to update releasenotes. |
Description
As discussed in #286, the
no_internet
context manager added in #284 does not test what I thought it tested (that existingPortalClient
instances cannot access QCArchive over the internet). The_CachedPortalClient._no_session
context manager is a better way to guarantee this, and the usage ofportal_client_manager
in other tests also renders thetest_manager
test itself redundant. As a result, the wholetest_manager.py
file can be deleted. I also updated the_no_session
docs to avoid referring to the now-deletedno_internet
manager.Status