-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 several tests related to constants #10013
base: main
Are you sure you want to change the base?
Conversation
def test_all_elements_without_parent(self) -> None: | ||
node = astroid.extract_node("__all__ = []") | ||
node.value.elts.append(astroid.Const("test")) | ||
node.value.elts.append(astroid.Const("test", parent=None)) | ||
root = node.root() | ||
with self.assertNoMessages(): | ||
self.checker.visit_module(root) |
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 it's a good test. Why should adding a constant not result in messages? That's just asserting implementation quirks. We should test the opposite, we should test that synthetic constants result in the same messages.
IMO
bd66249
to
37df2ed
Compare
This comment has been minimized.
This comment has been minimized.
Hi @temyurchenko 👋 We released an alpha of astroid 4 and updated your branch to use it. Would you mind taking a look at that last test failure? Many thanks. |
Hey, for sure! Hopefully, within the week |
The bug is actually caused by pylint-dev/astroid#2589, which changed the order of paths to look in, for module discovery. That PR on its own is not really unreasonable; it's just that the module path discovery is messy. |
37df2ed
to
64f6234
Compare
I've made a commit that is hopefully fixing the issue above. The commit message is describing the issue and the solution in detail. |
f9bbc50
to
e1f3eea
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10013 +/- ##
==========================================
+ Coverage 95.84% 95.85% +0.01%
==========================================
Files 175 175
Lines 19058 19056 -2
==========================================
+ Hits 18266 18267 +1
+ Misses 792 789 -3
|
I've added some tests that test regressions in the tests. I've also made the message to include the number of times a certain message is missing or extra. Without it, I had a very confusing experience, when I seemed to have the message and yet the test-suite reported that I don't. Turned out, I had to add four more of the same!
The problem was caused by pylint-dev/astroid#2589, changing the package discovery. Since tests/reporters/ didn't have `__init__.py`, the new package discovery would resolve module names as one level higher than desired (so, `unittest_reporting` instead of `reporters.unittest_reporting`). We're fixing this, by adding the appropriate `__init__.py`. We're also adding the `ModuleDescriptionDict` corresponding to the new `__init__.py` to the `expand_modules` tests. The changes in `expand_modules.py` are small optimizations mostly done in the process of understanding what is happening there.
e1f3eea
to
fb3b996
Compare
I've added some tests that test regressions in the tests.
I've also made the message to include the number of times a certain
message is missing or extra. Without it, I had a very confusing
experience, when I seemed to have the message and yet the
test-suite reported that I don't. Turned out, I had to add four
more of the same!
Type of Changes
Description
I'd be surprised if it passes the tests right now. This will need a new version of astroid to pass, specifically, pylint-dev/astroid#2602