Skip to content
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

Add tests for crash on inference of __len__ #5269

Merged
merged 2 commits into from
Nov 12, 2021

Conversation

DanielNoord
Copy link
Collaborator

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature, or an important bug fix, add a What's New entry in
    doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.
    -->

Type of Changes

Type
🐛 Bug fix

Description

These are the tests for pylint-dev/astroid#1234

This closes #5244

@DanielNoord DanielNoord added Crash 💥 A bug that makes pylint crash Needs astroid update Needs an astroid update (probably a release too) before being mergable labels Nov 6, 2021
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you !

tests/test_regr.py Outdated Show resolved Hide resolved
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is needed anymore as the test cases I suggested in pylint-dev/astroid#1234 (review) should cover it.

@DanielNoord
Copy link
Collaborator Author

Closing in favour of tests in pylint-dev/astroid#1234.

@DanielNoord DanielNoord closed this Nov 8, 2021
@DanielNoord DanielNoord deleted the numpy branch November 8, 2021 11:21
@Pierre-Sassoulas
Copy link
Member

I think adding regression tests in pylint is a nice way to close the pylint issue when the problem is really fixed, right now pylint #5244 is closed but astroid is not upgraded in pylint to 2.8.5 yet so the issue will persist if we release pylint 2.12.0 without upgrading to astroid 2.8.5 first. The cost of running the test in pylint is not very high too.

@DanielNoord DanielNoord restored the numpy branch November 8, 2021 16:23
@DanielNoord DanielNoord reopened this Nov 8, 2021
@DanielNoord
Copy link
Collaborator Author

I have reopened the PR although the names shall have to be updated (numpy was not the main cause of this issue).

@DanielNoord
Copy link
Collaborator Author

Tests have been renamed. Did not add a changelog entry as that really felt unwarranted since 1) the change is really in astroid and 2) no user has reported this other than myself :)

@coveralls
Copy link

coveralls commented Nov 8, 2021

Pull Request Test Coverage Report for Build 1453677129

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.362%

Totals Coverage Status
Change from base Build 1452882856: 0.0%
Covered Lines: 13812
Relevant Lines: 14794

💛 - Coveralls

cdce8p
cdce8p previously requested changes Nov 8, 2021
Comment on lines 12 to 14
def __len__(self):
"""Initially reported crash crashed on this function def"""
return len(self.array)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't test anything anymore. Apparent as all tests pass without the fix.
Either revert the module name change or use the example for the code review (with lambda). This can even be added as a normal functional test as it doesn't depend on the module name.

class MyClass:
    def some_func(self):
        return lambda: 42

    def __len__(self):
        return len(self.some_func())

@DanielNoord
Copy link
Collaborator Author

Updated to actually crash (and be resolved by astroid 2.8.5 again).

@Pierre-Sassoulas
Copy link
Member

I just released astroid 2.8.5, would you mind upgrading the version in this PR as it's the one that needs it ? :)

@DanielNoord DanielNoord reopened this Nov 12, 2021
@DanielNoord
Copy link
Collaborator Author

Ah misunderstood you. Added a preceding commit that bumps the version :)

@Pierre-Sassoulas Pierre-Sassoulas dismissed cdce8p’s stale review November 12, 2021 15:39

The test were not passing in the latest commit before upgrading to astroid 2.8.5

@Pierre-Sassoulas Pierre-Sassoulas merged commit 850d122 into pylint-dev:main Nov 12, 2021
@DanielNoord DanielNoord deleted the numpy branch November 12, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash Needs astroid update Needs an astroid update (probably a release too) before being mergable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on nodes.FunctionDef._proxied in numpy tests
4 participants