ambv / flake8-mypy

A plugin for flake8 integrating Mypy.
MIT License
102 stars 17 forks source link

AssertionError in test suite #8

Open ghisvail opened 6 years ago

ghisvail commented 6 years ago

I downloaded the latest flake8-mypy tarball on PyPI and tried to run its test suite in a clean Debian unstable image. However, testing fails with an AssertionError. The test log is pasted below:

python3.5 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.5.4, pytest-3.2.1, py-1.4.34, pluggy-0.4.0
rootdir: /<<PKGBUILDDIR>>, inifile:
collected 7 items

tests/test_mypy.py ...F...

=================================== FAILURES ===================================
_______________________ MypyTestCase.test_invalid_types ________________________

self = <tests.test_mypy.MypyTestCase testMethod=test_invalid_types>

    def test_invalid_types(self) -> None:
        mpc = self.get_mypychecker('invalid_types.py')
        errors = list(mpc.run())
        self.assertEqual(
            errors,
            self.errors(
                T484(5, 0, vars=('Missing return statement',)),
                T484(
                    10,
                    4,
                    vars=(
                        'Incompatible return value type (got "int", expected "str")',
                    ),
                ),
                T484(
                    10,
                    11,
                    vars=(
                        'Unsupported operand types for + ("int" and "str")',
                    ),
                ),
                T400(
                    13,
                    0,
                    vars=(
>                       "unused 'type: ignore' comment",
                    )
                )
            ),
        )
E       AssertionError: Lists differ: [(5, [279 chars]er'>)] != [(5, [279 chars]er'>), (13, 0, "T400 note: unused 'type: ignor[43 chars]r'>)]
E       
E       Second list contains 1 additional elements.
E       First extra element 3:
E       (13, 0, "T400 note: unused 'type: ignore' comment", <class 'flake8_mypy.MypyChecker'>)
E       
E         [(5, 0, 'T484 Missing return statement', <class 'flake8_mypy.MypyChecker'>),
E          (10,
E           4,
E           'T484 Incompatible return value type (got "int", expected "str")',
E           <class 'flake8_mypy.MypyChecker'>),
E          (10,
E           11,
E           'T484 Unsupported operand types for + ("int" and "str")',
E       +   <class 'flake8_mypy.MypyChecker'>),
E       +  (13,
E       +   0,
E       +   "T400 note: unused 'type: ignore' comment",
E           <class 'flake8_mypy.MypyChecker'>)]

tests/test_mypy.py:89: AssertionError
====================== 1 failed, 6 passed in 4.64 seconds ======================
ghisvail commented 6 years ago
[(5, [279 chars]er'>)] != [(5, [279 chars]er'>), (13, 0, "T400 note: unused 'type: ignor[43 chars]r'>)]

The second list contains an error with a funny format. Any idea @ambv ?

ambv commented 6 years ago

Set "maxDiff = None" in the test case class to see the full diff. I cannot repro, what mypy version is that with?

ghisvail commented 6 years ago

what mypy version is that with?

According to the logs, version 0.530.