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

Failing tests with pylint 2.0.0 on Fedora rawhide #2288

Closed
lupinix opened this issue Jul 15, 2018 · 7 comments
Closed

Failing tests with pylint 2.0.0 on Fedora rawhide #2288

lupinix opened this issue Jul 15, 2018 · 7 comments

Comments

@lupinix
Copy link

lupinix commented Jul 15, 2018

While working on the upgrade of pylint to 2.0.0 in Fedora Rawhide, I recognized the following test failures:

=================================== FAILURES ===================================
_________________ test_functional[useless_object_inheritance] __________________
test_file = <test_functional.FunctionalTestFile object at 0x7fea7225df60>
    @pytest.mark.parametrize("test_file", TESTS, ids=TESTS_NAMES)
    def test_functional(test_file):
        LintTest = LintModuleOutputUpdate(test_file) if UPDATE else LintModuleTest(test_file)
        LintTest.setUp()
>       LintTest._runTest()
pylint/test/test_functional.py:378: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <test_functional.LintModuleTest object at 0x7fea698dcf98>
    def _runTest(self):
        self._linter.check([self._test_file.module])
    
        expected_messages, expected_text = self._get_expected()
        received_messages, received_text = self._get_received()
    
        if expected_messages != received_messages:
            msg = ['Wrong results for file "%s":' % (self._test_file.base)]
            missing, unexpected = multiset_difference(expected_messages,
                                                      received_messages)
            if missing:
                msg.append('\nExpected in testdata:')
                msg.extend(' %3d: %s' % msg for msg in sorted(missing))
            if unexpected:
                msg.append('\nUnexpected in testdata:')
                msg.extend(' %3d: %s' % msg for msg in sorted(unexpected))
>           pytest.fail('\n'.join(msg))
E           Failed: Wrong results for file "useless_object_inheritance":
E           
E           Unexpected in testdata:
E              6: unused-import
pylint/test/test_functional.py:322: Failed
________________________ test_good_comprehension_checks ________________________
    def test_good_comprehension_checks():
        [data for data in range(100)]
        [data for data in range(100) if data]
>       [data for data in range(100) if len(data)]
/builddir/build/BUILD/pylint-2.0.0/pylint/test/functional/using_constant_test.py:135: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.0 = <range_iterator object at 0x7fea50604240>
>   [data for data in range(100) if len(data)]
E   TypeError: object of type 'int' has no len()
/builddir/build/BUILD/pylint-2.0.0/pylint/test/functional/using_constant_test.py:135: TypeError
============== 2 failed, 833 passed, 38 skipped in 256.88 seconds ==============

Python: 3.7.0
astroid: 2.0
pylint: 2.0.0
pytest: 3.6.3

Any idea on this?

Greetings,
Christian

@brycepg
Copy link
Contributor

brycepg commented Jul 15, 2018

Could you post the command you used to execute the tests?

I can only reproduce one of these test failures (plus more) when executing the test directory directly from pylint installed in site-packages: pytest ~/envs/pylint2.0/lib/python3.6/site-packages/pylint/test

@PCManticore
Copy link
Contributor

I think Bryce is right. I cannot reproduce the unused-import error though, but the TypeError reproduces just fine, and it is the result of pytest loading that file instead of being picked by the pylint test scaffold.

@lupinix
Copy link
Author

lupinix commented Jul 16, 2018

The command is

python3 -m pytest -v

executed in source directory, not in site-packages.

@felixonmars
Copy link

I got only 1 failure on Arch's clean chroot with identical versions of the above dependencies:

=================================== FAILURES ===================================
_________________ test_functional[useless_object_inheritance] __________________

test_file = <test_functional.FunctionalTestFile object at 0x7f568c2c6be0>

    @pytest.mark.parametrize("test_file", TESTS, ids=TESTS_NAMES)
    def test_functional(test_file):
        LintTest = LintModuleOutputUpdate(test_file) if UPDATE else LintModuleTest(test_file)
        LintTest.setUp()
>       LintTest._runTest()

pylint/test/test_functional.py:378:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test_functional.LintModuleTest object at 0x7f5688337da0>

    def _runTest(self):
        self._linter.check([self._test_file.module])

        expected_messages, expected_text = self._get_expected()
        received_messages, received_text = self._get_received()

        if expected_messages != received_messages:
            msg = ['Wrong results for file "%s":' % (self._test_file.base)]
            missing, unexpected = multiset_difference(expected_messages,
                                                      received_messages)
            if missing:
                msg.append('\nExpected in testdata:')
                msg.extend(' %3d: %s' % msg for msg in sorted(missing))
            if unexpected:
                msg.append('\nUnexpected in testdata:')
                msg.extend(' %3d: %s' % msg for msg in sorted(unexpected))
>           pytest.fail('\n'.join(msg))
E           Failed: Wrong results for file "useless_object_inheritance":
E
E           Unexpected in testdata:
E              6: unused-import

pylint/test/test_functional.py:322: Failed
====== 1 failed, 957 passed, 70 skipped, 201 deselected in 34.95 seconds =======

@PCManticore PCManticore reopened this Jul 17, 2018
@felixonmars
Copy link

Note that I don't get the error with Python 3.6 and others unchanged. This should be related to Python 3.7 only.

@PCManticore
Copy link
Contributor

Hi @lupinix This should now be fixed in pylint's master with d13c8c6. Long story short, it was caused by abc having a Python implementation with a different name, messing up a couple of our checks. We'll do another 2.1 release this week with a couple of fixes that addresses some 2.0 faults.

@lupinix
Copy link
Author

lupinix commented Aug 1, 2018

I confirm it is fixed in 2.1.0, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants