pylint 2.6.2 tests failures on debian

Created on 19 Feb 2021  路  17Comments  路  Source: PyCQA/pylint

Hello,
while testing pylint 2.6.2, the test suite failed with this:

=================================== FAILURES ===================================
______________________ test_functional[missing_kwoa_py3] _______________________

test_file = FunctionalTest:missing_kwoa_py3

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

tests/test_functional.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pylint.testutils.LintModuleTest object at 0x7fe10f23fb80>

    def _runTest(self):
        modules_to_check = [self._test_file.source]
        self._linter.check(modules_to_check)
        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 "missing_kwoa_py3":
E           
E           Unexpected in testdata:
E             59: unsubscriptable-object
E             60: unsubscriptable-object

pylint/testutils.py:610: Failed
______________ test_functional[star_needs_assignment_target_py35] ______________

test_file = FunctionalTest:star_needs_assignment_target_py35

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

tests/test_functional.py:102: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pylint.testutils.LintModuleTest object at 0x7fe10e6b0d30>

    def _runTest(self):
        modules_to_check = [self._test_file.source]
        self._linter.check(modules_to_check)
        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 "star_needs_assignment_target_py35":
E           
E           Expected in testdata:
E             15: star-needs-assignment-target
E           
E           Unexpected in testdata:
E             15: syntax-error

pylint/testutils.py:610: Failed
_ TestEstablishBaselineBenchmarks.test_baseline_benchmark_j1_all_checks_lots_of_files _

self = <test_baseline_benchmarks.TestEstablishBaselineBenchmarks object at 0x7fe10531dbb0>
benchmark = <pytest_benchmark.fixture.BenchmarkFixture object at 0x7fe10531da60>

    def test_baseline_benchmark_j1_all_checks_lots_of_files(self, benchmark):
        """ Runs lots of files, with -j1, against all plug-ins

        ... that's the intent at least.
        """
        if benchmark.disabled:
            benchmark(print, "skipping, only benchmark large file counts")
            return  # _only_ run this test is profiling
        linter = PyLinter()

        # Register all checkers/extensions and enable them
>       register_plugins(
            linter, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
        )

tests/benchmark/test_baseline_benchmarks.py:311: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pylint/utils/utils.py:254: in register_plugins
    module = modutils.load_module_from_file(
/usr/lib/python3/dist-packages/astroid/modutils.py:240: in load_module_from_file
    return load_module_from_modpath(modpath)
/usr/lib/python3/dist-packages/astroid/modutils.py:225: in load_module_from_modpath
    return load_module_from_name(".".join(parts))
/usr/lib/python3/dist-packages/astroid/modutils.py:210: in load_module_from_name
    return importlib.import_module(dotted_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '.benchmarks', package = None

    def import_module(name, package=None):
        """Import a module.

        The 'package' argument is required when performing a relative import. It
        specifies the package to use as the anchor point from which to resolve the
        relative import to an absolute import.

        """
        level = 0
        if name.startswith('.'):
            if not package:
                msg = ("the 'package' argument is required to perform a relative "
                       "import for {!r}")
>               raise TypeError(msg.format(name))
E               TypeError: the 'package' argument is required to perform a relative import for '.benchmarks'

/usr/lib/python3.9/importlib/__init__.py:122: TypeError

python 3.9

Most helpful comment

@Pierre-Sassoulas i've just updated astroid to 2.5.1 and pylint to 2.7.2 in Debian -- thanks for releasing these bugfix version to make sure Debian has a great pylint!

All 17 comments

Hello, thank you for opening the issue. I can't reproduce, what is the output of pylint --version ?

pylint 2.6.2
astroid 2.5
Python 3.9.1+ (default, Feb  5 2021, 13:46:56) 
[GCC 10.2.1 20210110]

and i understand i am not _supposed_ to use astroid==2.5, but these errors were happening even with 2.4

Thank you. I think it's a problem with python 3.9. We were not testing for it when pylint 2.6.0 was released in august 2020 (2 months before python 3.9). We're working on releasing 2.7.0 that will be compatible with python 3.9 soon.

I don't think we can fix pylint 2.6.x for python 3.9, there is a high risk of a failed release what do you think @hippo91 ?

sounds good, any ETA for 3.7.0 release? Debian freeze (for the next stable release) has already started and there's not much time (few weeks) to land changes. We will be releasing with python 3.9 so having a working pylint would be great

Having pylint latest features in debian would be nice too, the current version is old. What would be the deadline for debian ? Does "few weeks" means 2 weeks or 10 ? :)

i'm afraid it's just about 2 weeks now :(

@sandrotosi pylint 2.7.0 has been released, let me know if there is any problem. We'll try to fix any issue that arise during the 2 weeks freeze period :)

@Pierre-Sassoulas i now see this failure with 2.7.0:

=================================== FAILURES ===================================
_ TestEstablishBaselineBenchmarks.test_baseline_benchmark_j1_all_checks_lots_of_files _

self = <test_baseline_benchmarks.TestEstablishBaselineBenchmarks object at 0x7f0d0d53cfa0>
benchmark = <pytest_benchmark.fixture.BenchmarkFixture object at 0x7f0d0d53c730>

    def test_baseline_benchmark_j1_all_checks_lots_of_files(self, benchmark):
        """Runs lots of files, with -j1, against all plug-ins

        ... that's the intent at least.
        """
        if benchmark.disabled:
            benchmark(print, "skipping, only benchmark large file counts")
            return  # _only_ run this test is profiling
        linter = PyLinter()

        # Register all checkers/extensions and enable them
>       register_plugins(
            linter, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
        )

tests/benchmark/test_baseline_benchmarks.py:343: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pylint/utils/utils.py:254: in register_plugins
    module = modutils.load_module_from_file(
/usr/lib/python3/dist-packages/astroid/modutils.py:240: in load_module_from_file
    return load_module_from_modpath(modpath)
/usr/lib/python3/dist-packages/astroid/modutils.py:225: in load_module_from_modpath
    return load_module_from_name(".".join(parts))
/usr/lib/python3/dist-packages/astroid/modutils.py:210: in load_module_from_name
    return importlib.import_module(dotted_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '.benchmarks', package = None

    def import_module(name, package=None):
        """Import a module.

        The 'package' argument is required when performing a relative import. It
        specifies the package to use as the anchor point from which to resolve the
        relative import to an absolute import.

        """
        level = 0
        if name.startswith('.'):
            if not package:
                msg = ("the 'package' argument is required to perform a relative "
                       "import for {!r}")
>               raise TypeError(msg.format(name))
E               TypeError: the 'package' argument is required to perform a relative import for '.benchmarks'

/usr/lib/python3.9/importlib/__init__.py:122: TypeError

Hello, the latest release 2.7.1 should fix this, we run all tests in continuous integration this time 馃槃

@Pierre-Sassoulas I though we could include the fix for #4131 in 2.7.1
This is blocking the update for quite a few projects.

We can put it in 2.7.2 now :)

I already opened a MR in astroid to fix it. Just need someone to review it 馃槈
https://github.com/PyCQA/astroid/pull/910

thanks @Pierre-Sassoulas , 2.7.1 built successfully and i just uploaded it to Debian.

if you guys end up releasing a new patch version for pylint or astroid, please ping me as soon as that happen cause i'll need to act swiftly if we want to try and make it for the freeze (ideally the deadline for an upload in debian is March 1st)

Hello @sandrotosi, we released 2.7.2 with some bug fixes especially one which prevent crash when analyzing GenericType, it would be much appreciated if it's possible to include this version instead of 2.7.1. 馃槃

@Pierre-Sassoulas i've just updated astroid to 2.5.1 and pylint to 2.7.2 in Debian -- thanks for releasing these bugfix version to make sure Debian has a great pylint!

@sandrotosi thanks for your work on debian and especially packaging pylint/debian!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethanchewy picture ethanchewy  路  3Comments

adamtheturtle picture adamtheturtle  路  3Comments

lancelote picture lancelote  路  3Comments

PCManticore picture PCManticore  路  3Comments

PCManticore picture PCManticore  路  3Comments