-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Check node
location attributes in unittests
#5383
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
Conversation
To be fair this is probably a nightmare to write too. How about we move most of this to the functional tests ? It's more understandable for contributor and a lot easier to maintain for us. Because a functional test would be reviewable with vscode + pylint (modulo finding a way to use a dev version in vscode) by opening the file and looking at the column displayed, right ? |
Not sure if converting to functional tests will take less time though.. I have never done it, did it take you much time last time? |
Well it's relatively fast, you copy paste code and then add the expected message where required ( |
I'll start working on it then. Keeping this PR open to track the progress on it so we know when the unittests are "testing" end_line. |
We're under 100 failed tests on 3.10 now 😄 |
e759298
to
8aabbfb
Compare
Only 36 tests left 🎉 but it look like the functional tests needs updating and there would be less than that. |
8aabbfb
to
9650c08
Compare
9650c08
to
3dffa12
Compare
Finally ready for review! |
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.
There's still a surprisingly big number of tests that can"t be moved to functional, but this became clearly more manageable, I'm glad we won't have to change the line/col manually for the migrated tests. Amazing work you did there !
@@ -30,6 +30,8 @@ def add_message( | |||
self, | |||
msg_id: str, | |||
line: Optional[int] = None, | |||
# pylint: disable=fixme | |||
# TODO: Make node non optional |
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.
👍
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.
Turns out this is actually because node is optional in pylint itself 😅
I guess we can add that to our mental todo list for 3.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.
Yeap, that's probably some work too :)
For some of the remaining tests it was simply just better to keep them as is. Some used parameterization or imported additional data which would be difficult to replicate in functional tests. |
I think unittest works really well with parametrization when applicable. How about adding a little doc about tests : Prefer functional tests, unless there are a lot of similar cases that can be parametrized, or if you're using additional data ? |
Pull Request Test Coverage Report for Build 1573560118
💛 - Coveralls |
I don't think we should give people reasons to write more unittests, they will probably already do so since it is the most common way of testing. |
doc/whatsnew/<current release.rst>
.Type of Changes
Description
List of unittests which "can't" be moved and are updated to now include location attributes:
TestMultiNamingStyle