-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 test imports #9982
Fix test imports #9982
Conversation
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #9982 +/- ##
=======================================
Coverage 95.80% 95.80%
=======================================
Files 174 174
Lines 18934 18934
=======================================
Hits 18140 18140
Misses 794 794
|
This comment has been minimized.
This comment has been minimized.
Seems to work okay, but I guess the primer files aren't covered? Is there a way to skip the coverage check for this one? |
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.
I don't think there's anything to fix, this is due to pylint not being installed properly:
Line 55 in c0ecd70
testutils = ["gitpython>3"] |
A possible solution would be to move the test utils in another package entirely, the name is reserved https://pypi.org/project/pylint-testutils/.
a570998
to
658d121
Compare
for more information, see https://pre-commit.ci
Okay, I installed the I dropped the Git import commit and replaced it with an unrelated change that moves |
The typing being all guarded is not consensual among pylint core maintainers (there's an ongoing discussion between you and Marc about this), let's not change anything before it is resolved. Also I'm not sure what the issue is, there's a test requirements file that you need to pip pylint/requirements_test_min.txt Line 7 in c0ecd70
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit d53332c |
My understanding is that the concern is with using the type guard project-wide. Is there an objection to using the type guard in each and every case? For this particular import, using the guard provides a clear material benefit: it allows running tests without all the test dependencies installed. |
There's a clear benefit to installing the test requirements from the test requirements file: you're not going to run into strange issue because you have an out of date dependency and we won't have to complexify the code to accomodate partially installed tests requirements. Also introducing unneeded typing guards MR by MR is not very different from introducing them all at once. The discussion still need to happens. I found the 'this is going to create churn' argument convincing and imo the 'default' at the moment is to not have typing guard unless necessary so if Marc thinks strongly that it's not desirable I would be in favor of not changing anything unless we have strong arguments in favor (like major performance improvment, or it becoming the standard). |
Type of Changes
Description
Trying to run
pytest
locally withoutgit
package installed raisesModuleNotFoundError
, even though primer is not run locally. Similar forpytest_benchmark
.This MR delays imports from
git
until they are actually used. Thepytest_benchmark
import was only used for typechecking, so it is pushed underTYPE_CHECKING
flag. (This is yet another benefit to separating typechecking imports from runtime imports.)